Skip to content
Snippets Groups Projects
Commit 591a2b63 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '311-problem-with-validation-of-map-backgrounds' into 'main'

fix validation for old projects

See merge request !281
parents a5126b43 b436c3fc
No related branches found
No related tags found
2 merge requests!289Resolve "allow to have plugins without panel",!281fix validation for old projects
Pipeline #97076 passed
Showing
with 45 additions and 24 deletions
minerva-front (18.0.1) stable; urgency=medium
* Bug fix: show cookie baner only when cookie baner link is provided (#304)
* Bug fix: when link to submap is provided add submap name (#303)
* Bug fix: some old maps could not be opened (#311)
-- Piotr Gawron <piotr.gawron@uni.lu> Thu, 24 Oct 2024 13:00:00 +0200
......
......@@ -9,11 +9,9 @@ import {
getReduxWrapperWithStore,
} from '@/utils/testing/getReduxWrapperWithStore';
import { act, render, screen, within } from '@testing-library/react';
import { HISTAMINE_MAP_ID, MAIN_MAP_ID } from '@/constants/mocks';
import { MapNavigation } from './MapNavigation.component';
const MAIN_MAP_ID = 5053;
const HISTAMINE_MAP_ID = 5052;
const renderComponent = (initialStoreState: InitialStoreState = {}): { store: StoreType } => {
const { Wrapper, store } = getReduxWrapperWithStore(initialStoreState);
......
......@@ -11,6 +11,7 @@ import {
} from '@/utils/testing/getReduxWrapperWithStore';
import { render, screen } from '@testing-library/react';
import { MockStoreEnhanced } from 'redux-mock-store';
import { HISTAMINE_MAP_ID, MAIN_MAP_ID, PRKN_SUBSTRATES_MAP_ID } from '@/constants/mocks';
import { BioEntitiesAccordion } from './BioEntitiesAccordion.component';
const renderComponent = (initialStoreState: InitialStoreState = {}): { store: StoreType } => {
......@@ -95,10 +96,22 @@ describe('BioEntitiesAccordion - component', () => {
},
});
expect(screen.getByText('Content (10)')).toBeInTheDocument();
expect(screen.getByText('Core PD map (3)')).toBeInTheDocument();
expect(screen.getByText('Histamine signaling (4)')).toBeInTheDocument();
expect(screen.getByText('PRKN substrates (3)')).toBeInTheDocument();
const countHistamine = bioEntitiesContentFixture.filter(
content => content.bioEntity.model === HISTAMINE_MAP_ID,
).length;
const countCore = bioEntitiesContentFixture.filter(
content => content.bioEntity.model === MAIN_MAP_ID,
).length;
const countPrkn = bioEntitiesContentFixture.filter(
content => content.bioEntity.model === PRKN_SUBSTRATES_MAP_ID,
).length;
const countAll = bioEntitiesContentFixture.length;
expect(screen.getByText(`Content (${countAll})`)).toBeInTheDocument();
expect(screen.getByText(`Core PD map (${countCore})`)).toBeInTheDocument();
expect(screen.getByText(`Histamine signaling (${countHistamine})`)).toBeInTheDocument();
expect(screen.getByText(`PRKN substrates (${countPrkn})`)).toBeInTheDocument();
});
it('should fire toggleIsContentTabOpened on accordion item button click', () => {
......
......@@ -62,6 +62,11 @@ const renderComponent = (
};
describe('PinsListItem - component ', () => {
drugsFixture[0].targets[0].targetParticipants[0].link = 'https://example.com/plugin.js';
drugsFixture[0].targets[0].targetParticipants[1].link = 'https://example.com/plugin.js';
chemicalsFixture[0].targets[0].targetParticipants[0].link = 'https://example.com/plugin.js';
chemicalsFixture[0].targets[0].targetParticipants[1].link = 'https://example.com/plugin.js';
it('should display full name of pin', () => {
renderComponent(DRUGS_PIN.name, DRUGS_PIN.pin, 'drugs', BIO_ENTITY, INITIAL_STORE_STATE);
......
......@@ -209,8 +209,6 @@ describe('handleAliasResults - util', () => {
'entityNumber/addNumbersToEntityNumberData',
'project/getBioEntityById/fulfilled',
'entityNumber/addNumbersToEntityNumberData',
'reactions/getByIds/pending',
'reactions/getByIds/fulfilled',
'project/getMultiBioEntity/fulfilled',
'drawer/selectTab',
'drawer/openBioEntityDrawerById',
......
// eslint-disable-next-line no-magic-numbers
export const MODEL_IDS_MOCK = [5052, 5053, 5054];
export const MAIN_MAP_ID = 5053;
export const HISTAMINE_MAP_ID = 5052;
export const PRKN_SUBSTRATES_MAP_ID = 5054;
export const MODEL_IDS_MOCK = [HISTAMINE_MAP_ID, MAIN_MAP_ID, PRKN_SUBSTRATES_MAP_ID];
......@@ -35,7 +35,7 @@ export const bioEntitySchema = z.object({
.number()
.optional()
.transform(height => height ?? ZERO),
visibilityLevel: z.string(),
visibilityLevel: z.string().nullable(),
transparencyLevel: z.string().nullable().optional(),
synonyms: z.array(z.string()),
formerSymbols: z.array(z.string()).nullable().optional(),
......@@ -47,13 +47,13 @@ export const bioEntitySchema = z.object({
activity: z.boolean().optional(),
structuralState: z.optional(structuralStateSchema.nullable()),
hypothetical: z.boolean().nullable().optional(),
boundaryCondition: z.boolean().optional(),
constant: z.boolean().optional(),
boundaryCondition: z.boolean().optional().nullable(),
constant: z.boolean().optional().nullable(),
initialAmount: z.number().nullable().optional(),
initialConcentration: z.number().nullable().optional(),
charge: z.number().nullable().optional(),
substanceUnits: z.string().nullable().optional(),
onlySubstanceUnits: z.boolean().optional(),
onlySubstanceUnits: z.boolean().optional().nullable(),
modificationResidues: z.optional(z.array(modificationResiduesSchema)),
complex: z.number().nullable().optional(),
compartment: z.number().nullable().optional(),
......
......@@ -32,7 +32,7 @@ export const compartmentPathwayDetailsSchema = z.object({
formula: z.null(),
fullName: z.string().nullable(),
glyph: z.any(),
hierarchyVisibilityLevel: z.string(),
hierarchyVisibilityLevel: z.string().nullable(),
homomultimer: z.null(),
hypothetical: z.null(),
id: z.number().gt(-1),
......
......@@ -8,7 +8,7 @@ export const mapBackground = z.object({
creator: z.object({ login: z.string() }),
status: z.string(),
progress: z.number(),
description: z.null(),
description: z.string().nullable(),
order: z.number(),
images: z.array(
z.object({
......
......@@ -18,7 +18,7 @@ export const overlayLeftBioEntitySchema = z.object({
fontColor: colorSchema.optional(),
fillColor: colorSchema.optional(),
borderColor: colorSchema,
visibilityLevel: z.string(),
visibilityLevel: z.string().nullable(),
transparencyLevel: z.string(),
notes: z.string(),
symbol: z.string().nullable(),
......@@ -40,10 +40,10 @@ export const overlayLeftBioEntitySchema = z.object({
initialAmount: z.unknown().nullable(),
charge: z.unknown(),
initialConcentration: z.number().nullable().optional(),
onlySubstanceUnits: z.unknown(),
onlySubstanceUnits: z.boolean().nullable().optional(),
homodimer: z.number().optional(),
hypothetical: z.unknown(),
boundaryCondition: z.boolean().optional(),
boundaryCondition: z.boolean().optional().nullable(),
constant: z.boolean().nullable().optional(),
modificationResidues: z.unknown(),
stringType: z.string(),
......
......@@ -17,7 +17,7 @@ export const overlayLeftReactionSchema = z.object({
upperBound: z.null(),
subsystem: z.null(),
geneProteinReaction: z.null(),
visibilityLevel: z.string(),
visibilityLevel: z.string().nullable(),
z: z.number(),
synonyms: z.array(z.unknown()),
model: z.number(),
......
......@@ -6,7 +6,7 @@ import { referenceSchema } from './referenceSchema';
export const reactionSchema = z.object({
centerPoint: positionSchema,
hierarchyVisibilityLevel: z.string(),
hierarchyVisibilityLevel: z.string().nullable(),
id: z.number(),
kineticLaw: z.null(),
lines: z.array(reactionLineSchema),
......
......@@ -25,7 +25,10 @@ export const getFirstVisibleParent = async ({
apiPath.getElementById(parentId, bioEntity.model),
);
const parent = parentResponse.data;
if (parseInt(parent.visibilityLevel, 10) > Math.ceil(considerZoomLevel)) {
if (
parent.visibilityLevel !== null &&
parseInt(parent.visibilityLevel, 10) > Math.ceil(considerZoomLevel)
) {
return getFirstVisibleParent({
bioEntity: parent,
considerZoomLevel,
......@@ -70,8 +73,9 @@ export const getElementsByPoint = async ({
);
const element = elementResponse.data;
if (
element.visibilityLevel != null &&
parseInt(element.visibilityLevel, 10) - (ONE - FRACTIONAL_ZOOM_AT_WHICH_IMAGE_LAYER_CHANGE) >
(considerZoomLevel || Number.MAX_SAFE_INTEGER)
(considerZoomLevel || Number.MAX_SAFE_INTEGER)
) {
const visibleParent = await getFirstVisibleParent({
bioEntity: element,
......
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