Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions cypress/e2e/pages/cytAssist.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import {
FindFlaggedLabwareQuery,
FindFlaggedLabwareQueryVariables,
FindIfOpExistsQuery,
FindIfOpExistsQueryVariables,
LabwareState,
ReloadSlotCopyQuery,
ReloadSlotCopyQueryVariables,
SlideCosting,
SlotCopyMutation,
SlotCopyMutationVariables,
FindIfOpExistsQuery,
FindIfOpExistsQueryVariables
SlotCopyMutationVariables
} from '../../../src/types/sdk';
import { HttpResponse } from 'msw';
import { LabwareTypeName } from '../../../src/types/stan';
Expand Down Expand Up @@ -188,7 +188,9 @@
});
});
it('should display Invalid format error message', () => {
cy.findByText('Invalid format for this labware type').should('be.visible');
cy.contains(`Invalid format for ${LabwareTypeName.VISIUM_LP_CYTASSIST_XL}. Example: V42A20-3752023-10-20`).should(
'be.visible'
);
});
});
context('When external id is entered in correct format', () => {
Expand Down Expand Up @@ -222,7 +224,9 @@
selectLabwareType(LabwareTypeName.VISIUM_LP_CYTASSIST_HD);
});
it('should validate the external barcode ', () => {
cy.contains('Invalid format for VISIUM LP CYTASSIST').should('be.visible');
cy.contains(`Invalid format for ${LabwareTypeName.VISIUM_LP_CYTASSIST_HD}. Example: H1-9D8VN2V`).should(
'be.visible'
);
});
it('clears out all the mapping ', () => {
cy.findByTestId('STAN-3100').within(() => {
Expand Down Expand Up @@ -646,10 +650,10 @@
cy.findByTestId('reagentLot').clear().type(`${lotNumber}{enter}`);
}

function enterReagentALOTNumber(lotNumber: string) {

Check warning on line 653 in cypress/e2e/pages/cytAssist.cy.ts

View workflow job for this annotation

GitHub Actions / Lint with ESLint

'enterReagentALOTNumber' is defined but never used
cy.findByTestId('reagentALot').clear().type(`${lotNumber}{enter}`);
}
function enterReagentBLOTNumber(lotNumber: string) {

Check warning on line 656 in cypress/e2e/pages/cytAssist.cy.ts

View workflow job for this annotation

GitHub Actions / Lint with ESLint

'enterReagentBLOTNumber' is defined but never used
cy.findByTestId('reagentBLot').clear().type(`${lotNumber}{enter}`);
}

Expand Down
8 changes: 4 additions & 4 deletions src/components/slotMapper/MultipleLabwareSlotMapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import WhiteButton from '../buttons/WhiteButton';
import SlotMapperTable, { SlotMapperTableProps } from './SlotMapperTable';
import Warning from '../notifications/Warning';
import { useFormikContext } from 'formik';
import { CytAssistOutputLabwareForm } from '../../pages/CytAssist';
import { CytAssistOutputLabwareForm, isVisiumLpCytAssistHdLabware } from '../../pages/CytAssist';
import { flaggedLabwareLayout } from '../../lib/factories/labwareFactory';
import { eventBus } from '../../eventBus';
import { SavedDraft } from '../../lib/machines/slotCopy/slotCopyMachine';
Expand All @@ -47,17 +47,17 @@ type SelectedSlot = {
type SlotPassFail = Map<string, Set<SlotPassFailFieldsFragment>>; // key labware barcode, failedSlots array of failed slots

const validatePreBarcode = (preBarcode: string, labwareType: string) => {
if (labwareType === LabwareTypeName.VISIUM_LP_CYTASSIST_HD) {
if (isVisiumLpCytAssistHdLabware(labwareType)) {
const isValid = /^[A-Z0-9]{2}-[A-Z0-9]{7}$/.test(preBarcode);
return {
valid: isValid,
errorMessage: isValid ? undefined : 'Invalid format for VISIUM LP CYTASSIST HD. Example: H1-9D8VN2V'
errorMessage: isValid ? undefined : `Invalid format for ${labwareType}. Example: H1-9D8VN2V`
};
}
const isValid = /^[A-Z]\d{2}[A-Z]\d{2}-\d{7}-\d{2}-\d{2}$/.test(preBarcode);
return {
valid: isValid,
errorMessage: isValid ? undefined : 'Invalid format. Example: V42A20-3752023-10-20'
errorMessage: isValid ? undefined : `Invalid format for ${labwareType}. Example: V42A20-3752023-10-20`
};
};

Expand Down
20 changes: 16 additions & 4 deletions src/pages/CytAssist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,30 @@ const isCytAssistThreePointLabware = (labwareType: string) => {
);
};

export const isVisiumLpCytAssistHdLabware = (labwareType: string) => {
return (
labwareType === LabwareTypeName.VISIUM_LP_CYTASSIST_HD ||
labwareType === LabwareTypeName.VISIUM_LP_CYTASSIST_HD_11 ||
labwareType === LabwareTypeName.VISIUM_LP_CYTASSIST_HD_3_6_5 ||
labwareType === LabwareTypeName.VISIUM_LP_CYTASSIST_HD_3_11
);
};

const validationSchema = () => {
return Yup.object().shape({
labwareType: Yup.string().required('Required field'),
preBarcode: Yup.string().when('labwareType', (labwareType, schema) => {
const val = labwareType[0] as unknown as string;
return val === LabwareTypeName.VISIUM_LP_CYTASSIST_HD
const lt = labwareType[0] as unknown as string;
return isVisiumLpCytAssistHdLabware(lt)
? Yup.string()
.required('Required field')
.matches(/[A-Z0-9]{2}-[A-Z0-9]{7}/, 'Invalid format for a labware type of VISIUM_LP_CYTASSIST_HD')
.matches(/[A-Z0-9]{2}-[A-Z0-9]{7}/, `Invalid format for ${labwareType}. Example: H1-9D8VN2V`)
: Yup.string()
.required('Required field')
.matches(/[A-Z]\d{2}[A-Z]\d{2}-\d{7}-\d{2}-\d{2}/, 'Invalid format for this labware type');
.matches(
/[A-Z]\d{2}[A-Z]\d{2}-\d{7}-\d{2}-\d{2}/,
`Invalid format for ${labwareType}. Example: V42A20-3752023-10-20V42A20-3752023-10-20`
);
}),
lpNumber: Yup.string().oneOf(LP_NUMBERS).required('Required field'),
costing: Yup.string().required('Required field'),
Expand Down
Loading