Skip to content
Snippets Groups Projects

Feature: connect bio entity accordion to API

Merged Tadeusz Miesiąc requested to merge feature/bio-entity-drawer into development
1 unresolved thread
9 files
+ 555
29
Compare changes
  • Side-by-side
  • Inline
Files
9
 
import { StoreType } from '@/redux/store';
 
import {
 
InitialStoreState,
 
getReduxWrapperWithStore,
 
} from '@/utils/testing/getReduxWrapperWithStore';
 
import { render, screen } from '@testing-library/react';
 
import { bioEntitiesContentFixture } from '@/models/fixtures/bioEntityContentsFixture';
 
import { Accordion } from '@/shared/Accordion';
 
import { MODELS_MOCK } from '@/models/mocks/modelsMock';
 
import { BioEntitiesAccordion } from './BioEntitiesAccordion.component';
 
 
const renderComponent = (initialStoreState: InitialStoreState = {}): { store: StoreType } => {
 
const { Wrapper, store } = getReduxWrapperWithStore(initialStoreState);
 
 
return (
 
render(
 
<Wrapper>
 
<Accordion>
 
<BioEntitiesAccordion />
 
</Accordion>
 
</Wrapper>,
 
),
 
{
 
store,
 
}
 
);
 
};
 
 
describe('BioEntitiesAccordion - component', () => {
 
it('should display loading indicator when bioEntity search is pending', () => {
 
renderComponent({
 
bioEntity: {
 
data: undefined,
 
loading: 'pending',
 
error: { name: '', message: '' },
 
},
 
models: {
 
data: undefined,
 
loading: 'pending',
 
error: { name: '', message: '' },
 
},
 
});
 
 
expect(screen.getByText('Content (Loading...)')).toBeInTheDocument();
 
});
 
 
it('should render list of maps with number of entities after succeeded bio entity search', () => {
 
renderComponent({
 
bioEntity: {
 
data: bioEntitiesContentFixture,
 
loading: 'succeeded',
 
error: { name: '', message: '' },
 
},
 
models: {
 
data: MODELS_MOCK,
 
loading: 'succeeded',
 
error: { name: '', message: '' },
 
},
 
});
 
 
expect(screen.getByText('Content (10)')).toBeInTheDocument();
 
expect(screen.getByText('Core PD map (8)')).toBeInTheDocument();
 
expect(screen.getByText('Histamine signaling (2)')).toBeInTheDocument();
 
});
 
});
Loading