Skip to content

Commit

Permalink
Fixed schema and add new tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonLin0991 committed Jul 13, 2023
1 parent 2c806ad commit 6ad0f18
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down

0 comments on commit 6ad0f18

Please sign in to comment.