Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • minerva/frontend
1 result
Show changes
Commits on Source (14)
Showing
with 231 additions and 146 deletions
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
"react-dropzone": "14.2.3", "react-dropzone": "14.2.3",
"react-redux": "8.1.3", "react-redux": "8.1.3",
"react-select": "5.9.0", "react-select": "5.9.0",
"react-use-websocket": "4.11.1",
"sonner": "1.4.3", "sonner": "1.4.3",
"tailwind-merge": "1.14.0", "tailwind-merge": "1.14.0",
"tailwindcss": "3.4.13", "tailwindcss": "3.4.13",
...@@ -12275,6 +12276,11 @@ ...@@ -12275,6 +12276,11 @@
"react-dom": ">=16.6.0" "react-dom": ">=16.6.0"
} }
}, },
"node_modules/react-use-websocket": {
"version": "4.11.1",
"resolved": "https://registry.npmjs.org/react-use-websocket/-/react-use-websocket-4.11.1.tgz",
"integrity": "sha512-39e8mK2a2A1h8uY3ePF45b2q0vwMOmaEy7J5qEhQg4n7vYa5oDLmqutG36kZQgAQ/3KCZS0brlGRbbZJ0+zfKQ=="
},
"node_modules/read-cache": { "node_modules/read-cache": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
...@@ -14457,9 +14463,9 @@ ...@@ -14457,9 +14463,9 @@
"dev": true "dev": true
}, },
"node_modules/ws": { "node_modules/ws": {
"version": "8.16.0", "version": "8.17.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
"integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
"dev": true, "dev": true,
"engines": { "engines": {
"node": ">=10.0.0" "node": ">=10.0.0"
...@@ -23504,6 +23510,11 @@ ...@@ -23504,6 +23510,11 @@
"prop-types": "^15.6.2" "prop-types": "^15.6.2"
} }
}, },
"react-use-websocket": {
"version": "4.11.1",
"resolved": "https://registry.npmjs.org/react-use-websocket/-/react-use-websocket-4.11.1.tgz",
"integrity": "sha512-39e8mK2a2A1h8uY3ePF45b2q0vwMOmaEy7J5qEhQg4n7vYa5oDLmqutG36kZQgAQ/3KCZS0brlGRbbZJ0+zfKQ=="
},
"read-cache": { "read-cache": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
...@@ -25133,9 +25144,9 @@ ...@@ -25133,9 +25144,9 @@
} }
}, },
"ws": { "ws": {
"version": "8.16.0", "version": "8.17.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
"integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
"dev": true, "dev": true,
"requires": {} "requires": {}
}, },
......
...@@ -4,6 +4,7 @@ import { ReactNode } from 'react'; ...@@ -4,6 +4,7 @@ import { ReactNode } from 'react';
import { Provider } from 'react-redux'; import { Provider } from 'react-redux';
import { Toaster } from 'sonner'; import { Toaster } from 'sonner';
import { Modal } from '@/components/FunctionalArea/Modal'; import { Modal } from '@/components/FunctionalArea/Modal';
import { WebSocketEntityUpdatesProvider } from '@/utils/websocket-entity-updates/webSocketEntityUpdatesProvider';
interface AppWrapperProps { interface AppWrapperProps {
children: ReactNode; children: ReactNode;
...@@ -13,17 +14,19 @@ export const AppWrapper = ({ children }: AppWrapperProps): JSX.Element => { ...@@ -13,17 +14,19 @@ export const AppWrapper = ({ children }: AppWrapperProps): JSX.Element => {
return ( return (
<MapInstanceProvider> <MapInstanceProvider>
<Provider store={store}> <Provider store={store}>
<> <WebSocketEntityUpdatesProvider>
<Modal /> <>
<Toaster <Modal />
position="top-center" <Toaster
visibleToasts={1} position="top-center"
style={{ visibleToasts={1}
width: '700px', style={{
}} width: '700px',
/> }}
{children} />
</> {children}
</>
</WebSocketEntityUpdatesProvider>
</Provider> </Provider>
</MapInstanceProvider> </MapInstanceProvider>
); );
......
...@@ -8,6 +8,8 @@ import { act, render, screen } from '@testing-library/react'; ...@@ -8,6 +8,8 @@ import { act, render, screen } from '@testing-library/react';
import { CONTEXT_MENU_INITIAL_STATE } from '@/redux/contextMenu/contextMenu.constants'; import { CONTEXT_MENU_INITIAL_STATE } from '@/redux/contextMenu/contextMenu.constants';
import { bioEntityContentFixture } from '@/models/fixtures/bioEntityContentsFixture'; import { bioEntityContentFixture } from '@/models/fixtures/bioEntityContentsFixture';
import { PluginsContextMenu } from '@/services/pluginsManager/pluginContextMenu/pluginsContextMenu'; import { PluginsContextMenu } from '@/services/pluginsManager/pluginContextMenu/pluginsContextMenu';
import { modelElementFixture } from '@/models/fixtures/modelElementFixture';
import { DEFAULT_ERROR } from '@/constants/errors';
import { ContextMenu } from './ContextMenu.component'; import { ContextMenu } from './ContextMenu.component';
const renderComponent = (initialStore?: InitialStoreState): { store: StoreType } => { const renderComponent = (initialStore?: InitialStoreState): { store: StoreType } => {
...@@ -97,31 +99,40 @@ describe('ContextMenu - Component', () => { ...@@ -97,31 +99,40 @@ describe('ContextMenu - Component', () => {
it('should display uniprot id as option if it is provided', () => { it('should display uniprot id as option if it is provided', () => {
renderComponent({ renderComponent({
bioEntity: { modelElements: {
data: [ data: {
{ 0: {
searchQueryElement: bioEntityContentFixture.bioEntity.id.toString(), data: [modelElementFixture],
loading: 'succeeded', loading: 'succeeded',
error: { name: '', message: '' }, error: { message: '', name: '' },
data: [
{
...bioEntityContentFixture,
bioEntity: {
...bioEntityContentFixture.bioEntity,
fullName: 'BioEntity Full Name',
references: [
{
...bioEntityContentFixture.bioEntity.references[0],
type: 'UNIPROT',
},
],
},
},
],
}, },
], },
loading: 'succeeded', search: {
error: { message: '', name: '' }, data: [
{
searchQueryElement: modelElementFixture.id.toString(),
loading: 'succeeded',
error: DEFAULT_ERROR,
data: [
{
modelElement: {
...modelElementFixture,
fullName: 'BioEntity Full Name',
references: [
{
...bioEntityContentFixture.bioEntity.references[0],
type: 'UNIPROT',
},
],
},
perfect: true,
},
],
},
],
loading: 'pending',
error: DEFAULT_ERROR,
},
}, },
contextMenu: { contextMenu: {
...CONTEXT_MENU_INITIAL_STATE, ...CONTEXT_MENU_INITIAL_STATE,
...@@ -144,31 +155,40 @@ describe('ContextMenu - Component', () => { ...@@ -144,31 +155,40 @@ describe('ContextMenu - Component', () => {
it('should open molart modal when clicking on uniprot', async () => { it('should open molart modal when clicking on uniprot', async () => {
const { store } = renderComponent({ const { store } = renderComponent({
bioEntity: { modelElements: {
data: [ data: {
{ 0: {
searchQueryElement: bioEntityContentFixture.bioEntity.id.toString(), data: [modelElementFixture],
loading: 'succeeded', loading: 'succeeded',
error: { name: '', message: '' }, error: { message: '', name: '' },
data: [
{
...bioEntityContentFixture,
bioEntity: {
...bioEntityContentFixture.bioEntity,
fullName: 'BioEntity Full Name',
references: [
{
...bioEntityContentFixture.bioEntity.references[0],
type: 'UNIPROT',
},
],
},
},
],
}, },
], },
loading: 'succeeded', search: {
error: { message: '', name: '' }, data: [
{
searchQueryElement: modelElementFixture.id.toString(),
loading: 'succeeded',
error: DEFAULT_ERROR,
data: [
{
modelElement: {
...modelElementFixture,
fullName: 'BioEntity Full Name',
references: [
{
...bioEntityContentFixture.bioEntity.references[0],
type: 'UNIPROT',
},
],
},
perfect: true,
},
],
},
],
loading: 'pending',
error: DEFAULT_ERROR,
},
}, },
contextMenu: { contextMenu: {
...CONTEXT_MENU_INITIAL_STATE, ...CONTEXT_MENU_INITIAL_STATE,
......
import { searchedBioEntityElementUniProtIdSelector } from '@/redux/bioEntity/bioEntity.selectors';
import { contextMenuSelector } from '@/redux/contextMenu/contextMenu.selector'; import { contextMenuSelector } from '@/redux/contextMenu/contextMenu.selector';
import { closeContextMenu } from '@/redux/contextMenu/contextMenu.slice'; import { closeContextMenu } from '@/redux/contextMenu/contextMenu.slice';
import { useAppDispatch } from '@/redux/hooks/useAppDispatch'; import { useAppDispatch } from '@/redux/hooks/useAppDispatch';
...@@ -9,12 +8,13 @@ import { twMerge } from 'tailwind-merge'; ...@@ -9,12 +8,13 @@ import { twMerge } from 'tailwind-merge';
import { FIRST_ARRAY_ELEMENT, SECOND_ARRAY_ELEMENT, ZERO } from '@/constants/common'; import { FIRST_ARRAY_ELEMENT, SECOND_ARRAY_ELEMENT, ZERO } from '@/constants/common';
import { PluginsContextMenu } from '@/services/pluginsManager/pluginContextMenu/pluginsContextMenu'; import { PluginsContextMenu } from '@/services/pluginsManager/pluginContextMenu/pluginsContextMenu';
import { BioEntity, NewReaction } from '@/types/models'; import { ModelElement, NewReaction } from '@/types/models';
import { ClickCoordinates } from '@/services/pluginsManager/pluginContextMenu/pluginsContextMenu.types'; import { ClickCoordinates } from '@/services/pluginsManager/pluginContextMenu/pluginsContextMenu.types';
import { currentModelSelector } from '@/redux/models/models.selectors'; import { currentModelSelector } from '@/redux/models/models.selectors';
import { mapDataLastPositionSelector } from '@/redux/map/map.selectors'; import { mapDataLastPositionSelector } from '@/redux/map/map.selectors';
import { DEFAULT_ZOOM } from '@/constants/map'; import { DEFAULT_ZOOM } from '@/constants/map';
import { OutsideClickWrapper } from '@/shared/OutsideClickWrapper'; import { OutsideClickWrapper } from '@/shared/OutsideClickWrapper';
import { searchedModelElementUniProtIdSelector } from '@/redux/modelElements/modelElements.selector';
export const ContextMenu = (): React.ReactNode => { export const ContextMenu = (): React.ReactNode => {
const pluginContextMenu = PluginsContextMenu.menuItems; const pluginContextMenu = PluginsContextMenu.menuItems;
...@@ -22,7 +22,7 @@ export const ContextMenu = (): React.ReactNode => { ...@@ -22,7 +22,7 @@ export const ContextMenu = (): React.ReactNode => {
const lastPosition = useAppSelector(mapDataLastPositionSelector); const lastPosition = useAppSelector(mapDataLastPositionSelector);
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const { isOpen, coordinates } = useAppSelector(contextMenuSelector); const { isOpen, coordinates } = useAppSelector(contextMenuSelector);
const unitProtId = useAppSelector(searchedBioEntityElementUniProtIdSelector); const unitProtId = useAppSelector(searchedModelElementUniProtIdSelector);
const isUnitProtIdAvailable = (): boolean => unitProtId !== undefined; const isUnitProtIdAvailable = (): boolean => unitProtId !== undefined;
...@@ -49,7 +49,10 @@ export const ContextMenu = (): React.ReactNode => { ...@@ -49,7 +49,10 @@ export const ContextMenu = (): React.ReactNode => {
const modelId = model ? model.id : ZERO; const modelId = model ? model.id : ZERO;
const handleCallback = ( const handleCallback = (
callback: (coordinates: ClickCoordinates, element: BioEntity | NewReaction | undefined) => void, callback: (
coordinates: ClickCoordinates,
element: ModelElement | NewReaction | undefined,
) => void,
) => { ) => {
return () => { return () => {
closeContextMenuFunction(); closeContextMenuFunction();
......
...@@ -94,6 +94,7 @@ describe('EditOverlayModal - component', () => { ...@@ -94,6 +94,7 @@ describe('EditOverlayModal - component', () => {
login: 'test', login: 'test',
role: 'user', role: 'user',
userData: null, userData: null,
token: null,
}, },
modal: { modal: {
isOpen: true, isOpen: true,
...@@ -132,6 +133,7 @@ describe('EditOverlayModal - component', () => { ...@@ -132,6 +133,7 @@ describe('EditOverlayModal - component', () => {
login: 'test', login: 'test',
role: 'user', role: 'user',
userData: null, userData: null,
token: null,
}, },
modal: { modal: {
isOpen: true, isOpen: true,
...@@ -171,6 +173,7 @@ describe('EditOverlayModal - component', () => { ...@@ -171,6 +173,7 @@ describe('EditOverlayModal - component', () => {
login: 'test', login: 'test',
role: 'user', role: 'user',
userData: null, userData: null,
token: null,
}, },
modal: { modal: {
isOpen: true, isOpen: true,
...@@ -218,6 +221,7 @@ describe('EditOverlayModal - component', () => { ...@@ -218,6 +221,7 @@ describe('EditOverlayModal - component', () => {
login: 'test', login: 'test',
role: 'user', role: 'user',
userData: null, userData: null,
token: null,
}, },
modal: { modal: {
isOpen: true, isOpen: true,
......
...@@ -15,6 +15,7 @@ describe('useEditOverlay', () => { ...@@ -15,6 +15,7 @@ describe('useEditOverlay', () => {
login: 'test', login: 'test',
role: 'user', role: 'user',
userData: null, userData: null,
token: null,
}, },
modal: { modal: {
isOpen: true, isOpen: true,
...@@ -54,6 +55,7 @@ describe('useEditOverlay', () => { ...@@ -54,6 +55,7 @@ describe('useEditOverlay', () => {
login: 'test', login: 'test',
role: 'user', role: 'user',
userData: null, userData: null,
token: null,
}, },
modal: { modal: {
isOpen: true, isOpen: true,
...@@ -96,6 +98,7 @@ describe('useEditOverlay', () => { ...@@ -96,6 +98,7 @@ describe('useEditOverlay', () => {
login: null, login: null,
role: 'user', role: 'user',
userData: null, userData: null,
token: null,
}, },
modal: { modal: {
isOpen: true, isOpen: true,
...@@ -134,6 +137,7 @@ describe('useEditOverlay', () => { ...@@ -134,6 +137,7 @@ describe('useEditOverlay', () => {
login: 'test', login: 'test',
role: 'user', role: 'user',
userData: null, userData: null,
token: null,
}, },
modal: { modal: {
isOpen: true, isOpen: true,
...@@ -173,6 +177,7 @@ describe('useEditOverlay', () => { ...@@ -173,6 +177,7 @@ describe('useEditOverlay', () => {
login: null, login: null,
role: 'user', role: 'user',
userData: null, userData: null,
token: null,
}, },
modal: { modal: {
isOpen: true, isOpen: true,
......
...@@ -18,6 +18,8 @@ jest.mock('./utils/useOverviewImageSize', () => ({ ...@@ -18,6 +18,8 @@ jest.mock('./utils/useOverviewImageSize', () => ({
})), })),
})); }));
const PROJECT_DIRECTORY = 'directory';
const renderComponent = (initialStoreState: InitialStoreState = {}): { store: StoreType } => { const renderComponent = (initialStoreState: InitialStoreState = {}): { store: StoreType } => {
const { Wrapper, store } = getReduxWrapperWithStore(initialStoreState); const { Wrapper, store } = getReduxWrapperWithStore(initialStoreState);
...@@ -42,6 +44,7 @@ describe('OverviewImagesModal - component', () => { ...@@ -42,6 +44,7 @@ describe('OverviewImagesModal - component', () => {
...projectFixture, ...projectFixture,
overviewImageViews: [], overviewImageViews: [],
topOverviewImage: PROJECT_OVERVIEW_IMAGE_MOCK, topOverviewImage: PROJECT_OVERVIEW_IMAGE_MOCK,
directory: PROJECT_DIRECTORY,
}, },
loading: 'succeeded', loading: 'succeeded',
error: { message: '', name: '' }, error: { message: '', name: '' },
...@@ -70,6 +73,7 @@ describe('OverviewImagesModal - component', () => { ...@@ -70,6 +73,7 @@ describe('OverviewImagesModal - component', () => {
...projectFixture, ...projectFixture,
overviewImageViews: [PROJECT_OVERVIEW_IMAGE_MOCK], overviewImageViews: [PROJECT_OVERVIEW_IMAGE_MOCK],
topOverviewImage: PROJECT_OVERVIEW_IMAGE_MOCK, topOverviewImage: PROJECT_OVERVIEW_IMAGE_MOCK,
directory: PROJECT_DIRECTORY,
}, },
loading: 'succeeded', loading: 'succeeded',
error: { message: '', name: '' }, error: { message: '', name: '' },
...@@ -91,7 +95,7 @@ describe('OverviewImagesModal - component', () => { ...@@ -91,7 +95,7 @@ describe('OverviewImagesModal - component', () => {
it('should render image with valid src', () => { it('should render image with valid src', () => {
const imageElement = screen.getByAltText('overview'); const imageElement = screen.getByAltText('overview');
const result = `${BASE_MAP_IMAGES_URL}/map_images/${PROJECT_OVERVIEW_IMAGE_MOCK.filename}`; const result = `${BASE_MAP_IMAGES_URL}/map_images/${PROJECT_DIRECTORY}/${PROJECT_OVERVIEW_IMAGE_MOCK.filename}`;
expect(imageElement.getAttribute('src')).toBe(result); expect(imageElement.getAttribute('src')).toBe(result);
}); });
......
...@@ -7,6 +7,8 @@ import { getReduxWrapperWithStore } from '@/utils/testing/getReduxWrapperWithSto ...@@ -7,6 +7,8 @@ import { getReduxWrapperWithStore } from '@/utils/testing/getReduxWrapperWithSto
import { renderHook } from '@testing-library/react'; import { renderHook } from '@testing-library/react';
import { useOverviewImage } from './useOverviewImage'; import { useOverviewImage } from './useOverviewImage';
const PROJECT_DIRECTORY = 'directory';
describe('useOverviewImage - hook', () => { describe('useOverviewImage - hook', () => {
describe('when image data is invalid', () => { describe('when image data is invalid', () => {
const { Wrapper } = getReduxWrapperWithStore({ const { Wrapper } = getReduxWrapperWithStore({
...@@ -15,6 +17,7 @@ describe('useOverviewImage - hook', () => { ...@@ -15,6 +17,7 @@ describe('useOverviewImage - hook', () => {
...projectFixture, ...projectFixture,
overviewImageViews: [], overviewImageViews: [],
topOverviewImage: PROJECT_OVERVIEW_IMAGE_MOCK, topOverviewImage: PROJECT_OVERVIEW_IMAGE_MOCK,
directory: PROJECT_DIRECTORY,
}, },
loading: 'succeeded', loading: 'succeeded',
error: { message: '', name: '' }, error: { message: '', name: '' },
...@@ -48,6 +51,7 @@ describe('useOverviewImage - hook', () => { ...@@ -48,6 +51,7 @@ describe('useOverviewImage - hook', () => {
...projectFixture, ...projectFixture,
overviewImageViews: [PROJECT_OVERVIEW_IMAGE_MOCK], overviewImageViews: [PROJECT_OVERVIEW_IMAGE_MOCK],
topOverviewImage: PROJECT_OVERVIEW_IMAGE_MOCK, topOverviewImage: PROJECT_OVERVIEW_IMAGE_MOCK,
directory: PROJECT_DIRECTORY,
}, },
loading: 'succeeded', loading: 'succeeded',
error: { message: '', name: '' }, error: { message: '', name: '' },
...@@ -66,7 +70,7 @@ describe('useOverviewImage - hook', () => { ...@@ -66,7 +70,7 @@ describe('useOverviewImage - hook', () => {
}); });
it('should return default size of image and valid imageUrl', () => { it('should return default size of image and valid imageUrl', () => {
const imageUrl = `${BASE_MAP_IMAGES_URL}/map_images/${PROJECT_OVERVIEW_IMAGE_MOCK.filename}`; const imageUrl = `${BASE_MAP_IMAGES_URL}/map_images/${PROJECT_DIRECTORY}/${PROJECT_OVERVIEW_IMAGE_MOCK.filename}`;
expect(result.current).toMatchObject({ expect(result.current).toMatchObject({
imageUrl, imageUrl,
...@@ -88,6 +92,7 @@ describe('useOverviewImage - hook', () => { ...@@ -88,6 +92,7 @@ describe('useOverviewImage - hook', () => {
}, },
], ],
topOverviewImage: PROJECT_OVERVIEW_IMAGE_MOCK, topOverviewImage: PROJECT_OVERVIEW_IMAGE_MOCK,
directory: PROJECT_DIRECTORY,
}, },
loading: 'succeeded', loading: 'succeeded',
error: { message: '', name: '' }, error: { message: '', name: '' },
...@@ -109,7 +114,7 @@ describe('useOverviewImage - hook', () => { ...@@ -109,7 +114,7 @@ describe('useOverviewImage - hook', () => {
); );
it('should return size of image and valid imageUrl', () => { it('should return size of image and valid imageUrl', () => {
const imageUrl = `${BASE_MAP_IMAGES_URL}/map_images/${PROJECT_OVERVIEW_IMAGE_MOCK.filename}`; const imageUrl = `${BASE_MAP_IMAGES_URL}/map_images/${PROJECT_DIRECTORY}/${PROJECT_OVERVIEW_IMAGE_MOCK.filename}`;
expect(result.current).toMatchObject({ expect(result.current).toMatchObject({
imageUrl, imageUrl,
......
...@@ -6,6 +6,8 @@ import { getReduxWrapperWithStore } from '@/utils/testing/getReduxWrapperWithSto ...@@ -6,6 +6,8 @@ import { getReduxWrapperWithStore } from '@/utils/testing/getReduxWrapperWithSto
import { renderHook } from '@testing-library/react'; import { renderHook } from '@testing-library/react';
import { useOverviewImageUrl } from './useOverviewImageUrl'; import { useOverviewImageUrl } from './useOverviewImageUrl';
const PROJECT_DIRECTORY = 'directory';
describe('useOverviewImageUrl - hook', () => { describe('useOverviewImageUrl - hook', () => {
describe('when currentImage data is valid', () => { describe('when currentImage data is valid', () => {
const { Wrapper } = getReduxWrapperWithStore({ const { Wrapper } = getReduxWrapperWithStore({
...@@ -14,6 +16,7 @@ describe('useOverviewImageUrl - hook', () => { ...@@ -14,6 +16,7 @@ describe('useOverviewImageUrl - hook', () => {
...projectFixture, ...projectFixture,
overviewImageViews: [], overviewImageViews: [],
topOverviewImage: PROJECT_OVERVIEW_IMAGE_MOCK, topOverviewImage: PROJECT_OVERVIEW_IMAGE_MOCK,
directory: PROJECT_DIRECTORY,
}, },
loading: 'succeeded', loading: 'succeeded',
error: { message: '', name: '' }, error: { message: '', name: '' },
...@@ -41,6 +44,7 @@ describe('useOverviewImageUrl - hook', () => { ...@@ -41,6 +44,7 @@ describe('useOverviewImageUrl - hook', () => {
...projectFixture, ...projectFixture,
overviewImageViews: [PROJECT_OVERVIEW_IMAGE_MOCK], overviewImageViews: [PROJECT_OVERVIEW_IMAGE_MOCK],
topOverviewImage: PROJECT_OVERVIEW_IMAGE_MOCK, topOverviewImage: PROJECT_OVERVIEW_IMAGE_MOCK,
directory: PROJECT_DIRECTORY,
}, },
loading: 'succeeded', loading: 'succeeded',
error: { message: '', name: '' }, error: { message: '', name: '' },
...@@ -58,7 +62,7 @@ describe('useOverviewImageUrl - hook', () => { ...@@ -58,7 +62,7 @@ describe('useOverviewImageUrl - hook', () => {
const { result } = renderHook(() => useOverviewImageUrl(), { wrapper: Wrapper }); const { result } = renderHook(() => useOverviewImageUrl(), { wrapper: Wrapper });
expect(result.current).toBe( expect(result.current).toBe(
`${BASE_MAP_IMAGES_URL}/map_images/${PROJECT_OVERVIEW_IMAGE_MOCK.filename}`, `${BASE_MAP_IMAGES_URL}/map_images/${PROJECT_DIRECTORY}/${PROJECT_OVERVIEW_IMAGE_MOCK.filename}`,
); );
}); });
}); });
......
import { BASE_MAP_IMAGES_URL } from '@/constants'; import { BASE_MAP_IMAGES_URL } from '@/constants';
import { currentOverviewImageSelector } from '@/redux/project/project.selectors'; import {
currentOverviewImageSelector,
projectDirectorySelector,
} from '@/redux/project/project.selectors';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
export const useOverviewImageUrl = (): string => { export const useOverviewImageUrl = (): string => {
const currentImage = useSelector(currentOverviewImageSelector); const currentImage = useSelector(currentOverviewImageSelector);
const directory = useSelector(projectDirectorySelector);
if (!currentImage) { if (!currentImage || !directory) {
return ''; return '';
} }
return `${BASE_MAP_IMAGES_URL}/map_images/${currentImage.filename}`; return `${BASE_MAP_IMAGES_URL}/map_images/${directory}/${currentImage.filename}`;
}; };
...@@ -5,7 +5,7 @@ import { apiPath } from '@/redux/apiPath'; ...@@ -5,7 +5,7 @@ import { apiPath } from '@/redux/apiPath';
import { DEFAULT_POSITION } from '@/redux/map/map.constants'; import { DEFAULT_POSITION } from '@/redux/map/map.constants';
import { INITIAL_STORE_STATE_MOCK } from '@/redux/root/root.fixtures'; import { INITIAL_STORE_STATE_MOCK } from '@/redux/root/root.fixtures';
import { AppDispatch, RootState } from '@/redux/store'; import { AppDispatch, RootState } from '@/redux/store';
import { BioEntity, MapModel } from '@/types/models'; import { MapModel, PublicationElement } from '@/types/models';
import { mockNetworkNewAPIResponse } from '@/utils/mockNetworkResponse'; import { mockNetworkNewAPIResponse } from '@/utils/mockNetworkResponse';
import { import {
InitialStoreState, InitialStoreState,
...@@ -14,12 +14,12 @@ import { ...@@ -14,12 +14,12 @@ import {
import { render, screen, waitFor } from '@testing-library/react'; import { render, screen, waitFor } from '@testing-library/react';
import { HttpStatusCode } from 'axios'; import { HttpStatusCode } from 'axios';
import { MockStoreEnhanced } from 'redux-mock-store'; import { MockStoreEnhanced } from 'redux-mock-store';
import { isReactionBioEntity } from '@/redux/reactions/isReactionBioentity'; import { isReactionElement } from '@/redux/reactions/isReactionElement';
import { ElementLink } from './ElementLink.component'; import { ElementLink } from './ElementLink.component';
const mockedAxiosNewClient = mockNetworkNewAPIResponse(); const mockedAxiosNewClient = mockNetworkNewAPIResponse();
const TARGET_ELEMENT: BioEntity = { const TARGET_ELEMENT: PublicationElement = {
...bioEntityResponseFixture.content[FIRST_ARRAY_ELEMENT].bioEntity, ...bioEntityResponseFixture.content[FIRST_ARRAY_ELEMENT].bioEntity,
id: 123, id: 123,
model: 52, model: 52,
...@@ -36,20 +36,20 @@ const OTHER_MODEL: MapModel = { ...@@ -36,20 +36,20 @@ const OTHER_MODEL: MapModel = {
}; };
interface Props { interface Props {
target: BioEntity; target: PublicationElement;
} }
const getElementText = (bioEntity: BioEntity): string => { const getElementText = (element: PublicationElement): string => {
const isReaction = isReactionBioEntity(bioEntity); const isReaction = isReactionElement(element);
const prefix = isReaction ? 'Reaction: ' : 'Element: '; const prefix = isReaction ? 'Reaction: ' : 'Element: ';
return prefix + bioEntity.elementId; return prefix + element.elementId;
}; };
const getSearchQuery = (bioEntity: BioEntity): string => { const getSearchQuery = (element: PublicationElement): string => {
const isReaction = isReactionBioEntity(bioEntity); const isReaction = isReactionElement(element);
return (isReaction ? 'reaction:' : 'element:') + bioEntity.id; return (isReaction ? 'reaction:' : 'element:') + element.id;
}; };
const renderComponent = ( const renderComponent = (
...@@ -86,10 +86,10 @@ describe('ElementLink - component', () => { ...@@ -86,10 +86,10 @@ describe('ElementLink - component', () => {
}); });
it('should should show element id', async () => { it('should should show element id', async () => {
const bioEntity = TARGET_ELEMENT; const element = TARGET_ELEMENT;
await waitFor(() => { await waitFor(() => {
expect(screen.getByText(getElementText(bioEntity))).toBeInTheDocument(); expect(screen.getByText(getElementText(element))).toBeInTheDocument();
}); });
}); });
}); });
...@@ -116,10 +116,10 @@ describe('ElementLink - component', () => { ...@@ -116,10 +116,10 @@ describe('ElementLink - component', () => {
}, },
); );
const bioEntity = TARGET_ELEMENT; const element = TARGET_ELEMENT;
await waitFor(() => { await waitFor(() => {
const link = screen.getByText(getElementText(bioEntity)); const link = screen.getByText(getElementText(element));
link.click(); link.click();
const actions = store.getActions(); const actions = store.getActions();
...@@ -148,7 +148,7 @@ describe('ElementLink - component', () => { ...@@ -148,7 +148,7 @@ describe('ElementLink - component', () => {
expect(actions).toEqual( expect(actions).toEqual(
expect.arrayContaining([ expect.arrayContaining([
expect.objectContaining({ expect.objectContaining({
payload: getSearchQuery(bioEntity), payload: getSearchQuery(element),
type: 'drawer/openSearchDrawerWithSelectedTab', type: 'drawer/openSearchDrawerWithSelectedTab',
}), }),
]), ]),
...@@ -206,10 +206,10 @@ describe('ElementLink - component', () => { ...@@ -206,10 +206,10 @@ describe('ElementLink - component', () => {
}, },
); );
const bioEntity = TARGET_ELEMENT; const element = TARGET_ELEMENT;
await waitFor(() => { await waitFor(() => {
const link = screen.getByText(getElementText(bioEntity)); const link = screen.getByText(getElementText(element));
link.click(); link.click();
const actions = store.getActions(); const actions = store.getActions();
...@@ -238,7 +238,7 @@ describe('ElementLink - component', () => { ...@@ -238,7 +238,7 @@ describe('ElementLink - component', () => {
expect(actions).toEqual( expect(actions).toEqual(
expect.arrayContaining([ expect.arrayContaining([
expect.objectContaining({ expect.objectContaining({
payload: getSearchQuery(bioEntity), payload: getSearchQuery(element),
type: 'drawer/openSearchDrawerWithSelectedTab', type: 'drawer/openSearchDrawerWithSelectedTab',
}), }),
]), ]),
......
...@@ -13,11 +13,11 @@ import { closeModal } from '@/redux/modal/modal.slice'; ...@@ -13,11 +13,11 @@ import { closeModal } from '@/redux/modal/modal.slice';
import { modelsNameMapSelector } from '@/redux/models/models.selectors'; import { modelsNameMapSelector } from '@/redux/models/models.selectors';
import { getSearchData } from '@/redux/search/search.thunks'; import { getSearchData } from '@/redux/search/search.thunks';
import { PluginsEventBus } from '@/services/pluginsManager/pluginsEventBus'; import { PluginsEventBus } from '@/services/pluginsManager/pluginsEventBus';
import { BioEntity } from '@/types/models'; import { PublicationElement } from '@/types/models';
import { isReactionBioEntity } from '@/redux/reactions/isReactionBioentity'; import { isReactionElement } from '@/redux/reactions/isReactionElement';
interface Props { interface Props {
target: BioEntity; target: PublicationElement;
} }
export const ElementLink = ({ target }: Props): JSX.Element => { export const ElementLink = ({ target }: Props): JSX.Element => {
...@@ -26,7 +26,7 @@ export const ElementLink = ({ target }: Props): JSX.Element => { ...@@ -26,7 +26,7 @@ export const ElementLink = ({ target }: Props): JSX.Element => {
const currentModelId = useAppSelector(mapModelIdSelector); const currentModelId = useAppSelector(mapModelIdSelector);
const mapsNames = useAppSelector(modelsNameMapSelector); const mapsNames = useAppSelector(modelsNameMapSelector);
const isReaction = isReactionBioEntity(target); const isReaction = isReactionElement(target);
const isMapAlreadyOpened = (modelId: number): boolean => const isMapAlreadyOpened = (modelId: number): boolean =>
openedMaps.some(map => map.modelId === modelId); openedMaps.some(map => map.modelId === modelId);
......
import { INITIAL_STORE_STATE_MOCK } from '@/redux/root/root.fixtures'; import { INITIAL_STORE_STATE_MOCK } from '@/redux/root/root.fixtures';
import { AppDispatch, RootState } from '@/redux/store'; import { AppDispatch, RootState } from '@/redux/store';
import { BioEntity } from '@/types/models'; import { PublicationElement } from '@/types/models';
import { import {
InitialStoreState, InitialStoreState,
getReduxStoreWithActionsListener, getReduxStoreWithActionsListener,
} from '@/utils/testing/getReduxStoreActionsListener'; } from '@/utils/testing/getReduxStoreActionsListener';
import { render, screen, waitFor } from '@testing-library/react'; import { render, screen, waitFor } from '@testing-library/react';
import { MockStoreEnhanced } from 'redux-mock-store'; import { MockStoreEnhanced } from 'redux-mock-store';
import { bioEntityFixture } from '@/models/fixtures/bioEntityFixture'; import { isReactionElement } from '@/redux/reactions/isReactionElement';
import { isReactionBioEntity } from '@/redux/reactions/isReactionBioentity'; import { publicationElementFixture } from '@/models/fixtures/publicationElementFixture';
import { ElementsOnMapCell } from './ElementsOnMapCell.component'; import { ElementsOnMapCell } from './ElementsOnMapCell.component';
interface Props { interface Props {
targets: BioEntity[]; targets: PublicationElement[];
} }
const renderComponent = ( const renderComponent = (
...@@ -33,8 +33,8 @@ const renderComponent = ( ...@@ -33,8 +33,8 @@ const renderComponent = (
); );
}; };
const elementFixture = { ...bioEntityFixture, idReaction: undefined }; const elementFixture = { ...publicationElementFixture, idReaction: undefined };
const reactionFixture = { ...bioEntityFixture, idReaction: '123' }; const reactionFixture = { ...publicationElementFixture, idReaction: '123' };
const mockTargets = [{ ...elementFixture }, { ...reactionFixture }]; const mockTargets = [{ ...elementFixture }, { ...reactionFixture }];
...@@ -49,7 +49,7 @@ describe('ElementsOnMapCell - component', () => { ...@@ -49,7 +49,7 @@ describe('ElementsOnMapCell - component', () => {
await waitFor(() => { await waitFor(() => {
// type as elementId // type as elementId
const isReaction = isReactionBioEntity(bioEntity); const isReaction = isReactionElement(bioEntity);
const prefix = isReaction ? 'Reaction: ' : 'Element: '; const prefix = isReaction ? 'Reaction: ' : 'Element: ';
expect(screen.getByText(prefix + bioEntity.elementId)).toBeInTheDocument(); expect(screen.getByText(prefix + bioEntity.elementId)).toBeInTheDocument();
}); });
......
import { ONE } from '@/constants/common'; import { ONE } from '@/constants/common';
import { BioEntity } from '@/types/models'; import { PublicationElement } from '@/types/models';
import { ElementLink } from './ElementLink'; import { ElementLink } from './ElementLink';
interface Props { interface Props {
targets: BioEntity[]; targets: PublicationElement[];
} }
export const ElementsOnMapCell = ({ targets }: Props): JSX.Element => { export const ElementsOnMapCell = ({ targets }: Props): JSX.Element => {
......
...@@ -23,7 +23,7 @@ import { ...@@ -23,7 +23,7 @@ import {
} from '@tanstack/react-table'; } from '@tanstack/react-table';
import { useRef, useState } from 'react'; import { useRef, useState } from 'react';
import { z } from 'zod'; import { z } from 'zod';
import { bioEntitySchema } from '@/models/bioEntitySchema'; import { publicationElementSchema } from '@/models/publicationElementSchema';
import { ElementsOnMapCell } from './ElementsOnMapCell'; import { ElementsOnMapCell } from './ElementsOnMapCell';
import { FilterBySubmapHeader } from './FilterBySubmapHeader/FilterBySubmapHeader.component'; import { FilterBySubmapHeader } from './FilterBySubmapHeader/FilterBySubmapHeader.component';
import { DEFAULT_PAGE_SIZE } from './PublicationsTable.constants'; import { DEFAULT_PAGE_SIZE } from './PublicationsTable.constants';
...@@ -74,9 +74,7 @@ const columns = [ ...@@ -74,9 +74,7 @@ const columns = [
cell: ({ getValue }): JSX.Element => { cell: ({ getValue }): JSX.Element => {
try { try {
const valueObject: unknown = JSON.parse(getValue()); const valueObject: unknown = JSON.parse(getValue());
// eslint-disable-next-line no-console const targets = z.array(publicationElementSchema).parse(valueObject);
console.log(valueObject);
const targets = z.array(bioEntitySchema).parse(valueObject);
return <ElementsOnMapCell targets={targets} />; return <ElementsOnMapCell targets={targets} />;
} catch (error) { } catch (error) {
......
...@@ -49,7 +49,7 @@ describe('ClearAnchorsButton - component', () => { ...@@ -49,7 +49,7 @@ describe('ClearAnchorsButton - component', () => {
{ payload: undefined, type: 'contextMenu/closeContextMenu' }, { payload: undefined, type: 'contextMenu/closeContextMenu' },
{ payload: undefined, type: 'reactions/resetReactionsData' }, { payload: undefined, type: 'reactions/resetReactionsData' },
{ payload: undefined, type: 'search/clearSearchData' }, { payload: undefined, type: 'search/clearSearchData' },
{ payload: undefined, type: 'bioEntityContents/clearBioEntities' }, { payload: undefined, type: 'modelElements/clearSearchModelElements' },
{ payload: undefined, type: 'drugs/clearDrugsData' }, { payload: undefined, type: 'drugs/clearDrugsData' },
{ payload: undefined, type: 'chemicals/clearChemicalsData' }, { payload: undefined, type: 'chemicals/clearChemicalsData' },
]); ]);
...@@ -75,7 +75,7 @@ describe('ClearAnchorsButton - component', () => { ...@@ -75,7 +75,7 @@ describe('ClearAnchorsButton - component', () => {
{ payload: undefined, type: 'contextMenu/closeContextMenu' }, { payload: undefined, type: 'contextMenu/closeContextMenu' },
{ payload: undefined, type: 'reactions/resetReactionsData' }, { payload: undefined, type: 'reactions/resetReactionsData' },
{ payload: undefined, type: 'search/clearSearchData' }, { payload: undefined, type: 'search/clearSearchData' },
{ payload: undefined, type: 'bioEntityContents/clearBioEntities' }, { payload: undefined, type: 'modelElements/clearSearchModelElements' },
{ payload: undefined, type: 'drugs/clearDrugsData' }, { payload: undefined, type: 'drugs/clearDrugsData' },
{ payload: undefined, type: 'chemicals/clearChemicalsData' }, { payload: undefined, type: 'chemicals/clearChemicalsData' },
]); ]);
......
import { clearBioEntities } from '@/redux/bioEntity/bioEntity.slice';
import { clearChemicalsData } from '@/redux/chemicals/chemicals.slice'; import { clearChemicalsData } from '@/redux/chemicals/chemicals.slice';
import { closeContextMenu } from '@/redux/contextMenu/contextMenu.slice'; import { closeContextMenu } from '@/redux/contextMenu/contextMenu.slice';
import { resultDrawerOpen } from '@/redux/drawer/drawer.selectors'; import { resultDrawerOpen } from '@/redux/drawer/drawer.selectors';
...@@ -11,6 +10,7 @@ import { Button } from '@/shared/Button'; ...@@ -11,6 +10,7 @@ import { Button } from '@/shared/Button';
import { Icon } from '@/shared/Icon'; import { Icon } from '@/shared/Icon';
import React from 'react'; import React from 'react';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { clearSearchModelElements } from '@/redux/modelElements/modelElements.slice';
export const ClearAnchorsButton = (): React.ReactNode => { export const ClearAnchorsButton = (): React.ReactNode => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
...@@ -31,7 +31,7 @@ export const ClearAnchorsButton = (): React.ReactNode => { ...@@ -31,7 +31,7 @@ export const ClearAnchorsButton = (): React.ReactNode => {
dispatch(clearSearchData()); dispatch(clearSearchData());
// Reset old pins data // Reset old pins data
dispatch(clearBioEntities()); dispatch(clearSearchModelElements());
dispatch(clearDrugsData()); dispatch(clearDrugsData());
dispatch(clearChemicalsData()); dispatch(clearChemicalsData());
}; };
......
...@@ -126,6 +126,7 @@ describe('AuthenticatedUser component', () => { ...@@ -126,6 +126,7 @@ describe('AuthenticatedUser component', () => {
login: null, login: null,
role: null, role: null,
userData: null, userData: null,
token: null,
}); });
}); });
......
import { SIZE_OF_ARRAY_WITH_ONE_ELEMENT, ZERO } from '@/constants/common'; import { SIZE_OF_ARRAY_WITH_ONE_ELEMENT, ZERO } from '@/constants/common';
import { bioEntityContentFixture } from '@/models/fixtures/bioEntityContentsFixture';
import { MODELS_MOCK_SHORT } from '@/models/mocks/modelsMock'; import { MODELS_MOCK_SHORT } from '@/models/mocks/modelsMock';
import { import { BIOENTITY_INITIAL_STATE_MOCK } from '@/redux/bioEntity/bioEntity.mock';
BIOENTITY_INITIAL_STATE_MOCK,
BIO_ENTITY_LINKING_TO_SUBMAP_DATA_MOCK,
BIO_ENTITY_LINKING_TO_SUBMAP,
} from '@/redux/bioEntity/bioEntity.mock';
import { DRAWER_INITIAL_STATE } from '@/redux/drawer/drawer.constants'; import { DRAWER_INITIAL_STATE } from '@/redux/drawer/drawer.constants';
import { import {
initialMapDataFixture, initialMapDataFixture,
...@@ -21,6 +16,12 @@ import { ...@@ -21,6 +16,12 @@ import {
import { act, render, screen } from '@testing-library/react'; import { act, render, screen } from '@testing-library/react';
import { HISTAMINE_MAP_ID, MAIN_MAP_ID } from '@/constants/mocks'; import { HISTAMINE_MAP_ID, MAIN_MAP_ID } from '@/constants/mocks';
import { ModelElementsState } from '@/redux/modelElements/modelElements.types'; import { ModelElementsState } from '@/redux/modelElements/modelElements.types';
import {
MODEL_ELEMENT_LINKING_TO_SUBMAP,
MODEL_ELEMENTS_SEARCH_LINKING_TO_SUBMAP_DATA_MOCK,
} from '@/redux/modelElements/modelElements.mock';
import { DEFAULT_ERROR } from '@/constants/errors';
import { modelElementFixture } from '@/models/fixtures/modelElementFixture';
import { AssociatedSubmap } from './AssociatedSubmap.component'; import { AssociatedSubmap } from './AssociatedSubmap.component';
const renderComponent = (initialStoreState: InitialStoreState = {}): { store: StoreType } => { const renderComponent = (initialStoreState: InitialStoreState = {}): { store: StoreType } => {
...@@ -43,21 +44,27 @@ describe('AssociatedSubmap - component', () => { ...@@ -43,21 +44,27 @@ describe('AssociatedSubmap - component', () => {
renderComponent({ renderComponent({
bioEntity: { bioEntity: {
...BIOENTITY_INITIAL_STATE_MOCK, ...BIOENTITY_INITIAL_STATE_MOCK,
data: BIO_ENTITY_LINKING_TO_SUBMAP_DATA_MOCK,
}, },
drawer: { drawer: {
...DRAWER_INITIAL_STATE, ...DRAWER_INITIAL_STATE,
bioEntityDrawerState: { bioEntityDrawerState: {
bioentityId: bioEntityContentFixture.bioEntity.id, bioentityId: modelElementFixture.id,
drugs: {}, drugs: {},
chemicals: {}, chemicals: {},
}, },
}, },
modelElements: { modelElements: {
[MAIN_MAP_ID]: { data: {
data: [BIO_ENTITY_LINKING_TO_SUBMAP], [MAIN_MAP_ID]: {
loading: 'succeeded', data: [MODEL_ELEMENT_LINKING_TO_SUBMAP],
error: { message: '', name: '' }, loading: 'succeeded',
error: { message: '', name: '' },
},
},
search: {
data: MODEL_ELEMENTS_SEARCH_LINKING_TO_SUBMAP_DATA_MOCK,
loading: 'idle',
error: DEFAULT_ERROR,
}, },
} as ModelElementsState, } as ModelElementsState,
models: { models: {
...@@ -81,21 +88,27 @@ describe('AssociatedSubmap - component', () => { ...@@ -81,21 +88,27 @@ describe('AssociatedSubmap - component', () => {
}, },
bioEntity: { bioEntity: {
...BIOENTITY_INITIAL_STATE_MOCK, ...BIOENTITY_INITIAL_STATE_MOCK,
data: BIO_ENTITY_LINKING_TO_SUBMAP_DATA_MOCK,
}, },
drawer: { drawer: {
...DRAWER_INITIAL_STATE, ...DRAWER_INITIAL_STATE,
bioEntityDrawerState: { bioEntityDrawerState: {
bioentityId: bioEntityContentFixture.bioEntity.id, bioentityId: modelElementFixture.id,
drugs: {}, drugs: {},
chemicals: {}, chemicals: {},
}, },
}, },
modelElements: { modelElements: {
[MAIN_MAP_ID]: { data: {
data: [BIO_ENTITY_LINKING_TO_SUBMAP], [MAIN_MAP_ID]: {
loading: 'succeeded', data: [MODEL_ELEMENT_LINKING_TO_SUBMAP],
error: { message: '', name: '' }, loading: 'succeeded',
error: { message: '', name: '' },
},
},
search: {
data: MODEL_ELEMENTS_SEARCH_LINKING_TO_SUBMAP_DATA_MOCK,
loading: 'idle',
error: DEFAULT_ERROR,
}, },
} as ModelElementsState, } as ModelElementsState,
models: { models: {
...@@ -118,19 +131,25 @@ describe('AssociatedSubmap - component', () => { ...@@ -118,19 +131,25 @@ describe('AssociatedSubmap - component', () => {
}, },
bioEntity: { bioEntity: {
...BIOENTITY_INITIAL_STATE_MOCK, ...BIOENTITY_INITIAL_STATE_MOCK,
data: BIO_ENTITY_LINKING_TO_SUBMAP_DATA_MOCK,
}, },
modelElements: { modelElements: {
0: { data: {
data: [BIO_ENTITY_LINKING_TO_SUBMAP], 0: {
loading: 'succeeded', data: [MODEL_ELEMENT_LINKING_TO_SUBMAP],
error: { message: '', name: '' }, loading: 'succeeded',
error: { message: '', name: '' },
},
},
search: {
data: MODEL_ELEMENTS_SEARCH_LINKING_TO_SUBMAP_DATA_MOCK,
loading: 'idle',
error: DEFAULT_ERROR,
}, },
} as ModelElementsState, } as ModelElementsState,
drawer: { drawer: {
...DRAWER_INITIAL_STATE, ...DRAWER_INITIAL_STATE,
bioEntityDrawerState: { bioEntityDrawerState: {
bioentityId: bioEntityContentFixture.bioEntity.id, bioentityId: modelElementFixture.id,
drugs: {}, drugs: {},
chemicals: {}, chemicals: {},
}, },
...@@ -151,7 +170,6 @@ describe('AssociatedSubmap - component', () => { ...@@ -151,7 +170,6 @@ describe('AssociatedSubmap - component', () => {
modelName: 'Histamine signaling', modelName: 'Histamine signaling',
lastPosition: { x: 0, y: 0, z: 0 }, lastPosition: { x: 0, y: 0, z: 0 },
}); });
const openSubmapButton = screen.getByRole('button', { name: 'Open submap' }); const openSubmapButton = screen.getByRole('button', { name: 'Open submap' });
await act(() => { await act(() => {
openSubmapButton.click(); openSubmapButton.click();
...@@ -184,19 +202,25 @@ describe('AssociatedSubmap - component', () => { ...@@ -184,19 +202,25 @@ describe('AssociatedSubmap - component', () => {
}, },
bioEntity: { bioEntity: {
...BIOENTITY_INITIAL_STATE_MOCK, ...BIOENTITY_INITIAL_STATE_MOCK,
data: BIO_ENTITY_LINKING_TO_SUBMAP_DATA_MOCK,
}, },
modelElements: { modelElements: {
[MAIN_MAP_ID]: { data: {
data: [BIO_ENTITY_LINKING_TO_SUBMAP], [MAIN_MAP_ID]: {
loading: 'succeeded', data: [MODEL_ELEMENT_LINKING_TO_SUBMAP],
error: { message: '', name: '' }, loading: 'succeeded',
error: { message: '', name: '' },
},
},
search: {
data: MODEL_ELEMENTS_SEARCH_LINKING_TO_SUBMAP_DATA_MOCK,
loading: 'idle',
error: DEFAULT_ERROR,
}, },
} as ModelElementsState, } as ModelElementsState,
drawer: { drawer: {
...DRAWER_INITIAL_STATE, ...DRAWER_INITIAL_STATE,
bioEntityDrawerState: { bioEntityDrawerState: {
bioentityId: bioEntityContentFixture.bioEntity.id, bioentityId: modelElementFixture.id,
drugs: {}, drugs: {},
chemicals: {}, chemicals: {},
}, },
......