From 6ad0f18073562ee8257cde2cf8c41c4cfac7d5a4 Mon Sep 17 00:00:00 2001 From: Jason Lin Date: Wed, 12 Jul 2023 23:25:06 -0400 Subject: [PATCH] Fixed schema and add new tests. --- .../contractAndRatesZodSchema.ts | 2 +- .../contractAndRates/parseDomainData.test.ts | 23 +++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/services/app-api/src/domain-models/contractAndRates/contractAndRatesZodSchema.ts b/services/app-api/src/domain-models/contractAndRates/contractAndRatesZodSchema.ts index 4e3a9aa40b..a4c22e1cd9 100644 --- a/services/app-api/src/domain-models/contractAndRates/contractAndRatesZodSchema.ts +++ b/services/app-api/src/domain-models/contractAndRates/contractAndRatesZodSchema.ts @@ -22,7 +22,7 @@ const contractFormDataSchema = z.object({ addtlActuaryCommunicationPreference: actuaryCommunicationTypeSchema.optional(), supportingDocuments: z.array(submissionDocumentSchema), - contractType: contractTypeSchema.optional(), + contractType: contractTypeSchema, contractExecutionStatus: contractExecutionStatusSchema.optional(), contractDocuments: z.array(submissionDocumentSchema), contractDateStart: z.date().optional(), diff --git a/services/app-api/src/domain-models/contractAndRates/parseDomainData.test.ts b/services/app-api/src/domain-models/contractAndRates/parseDomainData.test.ts index 7948a63698..d9f65b3b78 100644 --- a/services/app-api/src/domain-models/contractAndRates/parseDomainData.test.ts +++ b/services/app-api/src/domain-models/contractAndRates/parseDomainData.test.ts @@ -88,15 +88,34 @@ describe('parseDomainData', () => { ) }) describe('parseDraftContractRevision', () => { + it('cant parse valid contract revision with no errors', () => { + const contractRevision = + createContractRevision() as DraftContractRevisionTableWithRelations + expect( + parseDraftContractRevision(contractRevision) + ).not.toBeInstanceOf(Error) + }) const draftContractRevisionsWithInvalidData: { revision: DraftContractRevisionTableWithRelations testDescription: string }[] = [ { revision: createContractRevision({ - programIDs: undefined, + submissionType: undefined, + }) as DraftContractRevisionTableWithRelations, + testDescription: 'invalid submissionType', + }, + { + revision: createContractRevision({ + submissionDescription: undefined, + }) as DraftContractRevisionTableWithRelations, + testDescription: 'invalid submissionDescription', + }, + { + revision: createContractRevision({ + contractType: undefined, }) as DraftContractRevisionTableWithRelations, - testDescription: 'invalid programIDs', + testDescription: 'invalid contractType', }, { revision: createContractRevision({