Skip to content
Snippets Groups Projects
Commit bf5646a9 authored by Adrian Orłów's avatar Adrian Orłów
Browse files

fix: rfc changes

parent 45ca304f
No related branches found
No related tags found
2 merge requests!223reset the pin numbers before search results are fetch (so the results will be...,!91feat: add legend for active overlays
Pipeline #84065 passed
import { BASE_API_URL, PROJECT_ID } from '@/constants';
import { overlaysFixture } from '@/models/fixtures/overlaysFixture';
import { OVERLAY_BIO_ENTITY_INITIAL_STATE_MOCK } from '@/redux/overlayBioEntity/overlayBioEntity.mock';
import {
OVERLAYS_PUBLIC_FETCHED_STATE_MOCK,
PUBLIC_OVERLAYS_MOCK,
} from '@/redux/overlays/overlays.mock';
import { StoreType } from '@/redux/store';
import {
InitialStoreState,
getReduxWrapperWithStore,
} from '@/utils/testing/getReduxWrapperWithStore';
import { render, screen } from '@testing-library/react';
import { activeOverlaysSelector } from '../../../../../redux/overlayBioEntity/overlayBioEntity.selector';
import { OverlaysLegends } from './OverlaysLegends.component';
jest.mock('../../../../../redux/overlayBioEntity/overlayBioEntity.selector', () => ({
activeOverlaysSelector: jest.fn(),
}));
const activeOverlaysSelectorMock = activeOverlaysSelector as unknown as jest.Mock;
const renderComponent = (initialStoreState: InitialStoreState = {}): { store: StoreType } => {
const { Wrapper, store } = getReduxWrapperWithStore(initialStoreState);
......@@ -33,8 +30,12 @@ const renderComponent = (initialStoreState: InitialStoreState = {}): { store: St
describe('OverlaysLegends - component', () => {
describe('when active overlays are empty', () => {
beforeEach(() => {
activeOverlaysSelectorMock.mockImplementation(() => []);
renderComponent();
renderComponent({
overlays: OVERLAYS_PUBLIC_FETCHED_STATE_MOCK,
overlayBioEntity: {
...OVERLAY_BIO_ENTITY_INITIAL_STATE_MOCK,
},
});
});
it('should not render list of overlays legends', () => {
......@@ -44,11 +45,16 @@ describe('OverlaysLegends - component', () => {
describe('when active overlays are present', () => {
beforeEach(() => {
activeOverlaysSelectorMock.mockImplementation(() => overlaysFixture);
renderComponent();
renderComponent({
overlays: OVERLAYS_PUBLIC_FETCHED_STATE_MOCK,
overlayBioEntity: {
...OVERLAY_BIO_ENTITY_INITIAL_STATE_MOCK,
overlaysId: PUBLIC_OVERLAYS_MOCK.map(o => o.idObject),
},
});
});
it.each(overlaysFixture)('should render overlay legend', overlay => {
it.each(PUBLIC_OVERLAYS_MOCK)('should render overlay legend', overlay => {
const image = screen.getByAltText(`${overlay.name} legend`);
expect(screen.getByText(overlay.name)).toBeInTheDocument();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment