From 0446bd9b83ade192297559a8a18d4fcf2b022cbb Mon Sep 17 00:00:00 2001 From: Matt Casey Date: Thu, 9 Jan 2025 15:48:34 -0700 Subject: [PATCH] fix answers test (#5151) --- .../upsertProposalFormAnswers.spec.ts | 52 ++++++++++++++++--- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/lib/proposals/forms/__tests__/upsertProposalFormAnswers.spec.ts b/lib/proposals/forms/__tests__/upsertProposalFormAnswers.spec.ts index 693f5e5605..c0dc2c3444 100644 --- a/lib/proposals/forms/__tests__/upsertProposalFormAnswers.spec.ts +++ b/lib/proposals/forms/__tests__/upsertProposalFormAnswers.spec.ts @@ -78,7 +78,13 @@ describe('upsertFormAnswers', () => { expect(updated1).toEqual( expect.arrayContaining([ - { ...answer1, id: expect.any(String), fieldId: fieldsInput[0].id, proposalId: proposal.id, type: 'short_text' } + expect.objectContaining({ + ...answer1, + id: expect.any(String), + fieldId: fieldsInput[0].id, + proposalId: proposal.id, + type: 'short_text' + }) ]) ); @@ -95,8 +101,20 @@ describe('upsertFormAnswers', () => { expect(updated2).toEqual( expect.arrayContaining([ - { ...answer1, id: expect.any(String), fieldId: fieldsInput[0].id, proposalId: proposal.id, type: 'short_text' }, - { ...answer2, id: expect.any(String), fieldId: fieldsInput[1].id, proposalId: proposal.id, type: 'long_text' } + expect.objectContaining({ + ...answer1, + id: expect.any(String), + fieldId: fieldsInput[0].id, + proposalId: proposal.id, + type: 'short_text' + }), + expect.objectContaining({ + ...answer2, + id: expect.any(String), + fieldId: fieldsInput[1].id, + proposalId: proposal.id, + type: 'long_text' + }) ]) ); }); @@ -154,8 +172,20 @@ describe('upsertFormAnswers', () => { expect(updated1).toEqual( expect.arrayContaining([ - { ...answer1, id: expect.any(String), fieldId: fieldsInput[0].id, proposalId: proposal.id, type: 'short_text' }, - { ...answer2, id: expect.any(String), fieldId: fieldsInput[1].id, proposalId: proposal.id, type: 'long_text' } + expect.objectContaining({ + ...answer1, + id: expect.any(String), + fieldId: fieldsInput[0].id, + proposalId: proposal.id, + type: 'short_text' + }), + expect.objectContaining({ + ...answer2, + id: expect.any(String), + fieldId: fieldsInput[1].id, + proposalId: proposal.id, + type: 'long_text' + }) ]) ); }); @@ -208,7 +238,13 @@ describe('upsertFormAnswers', () => { expect(updated1).toEqual( expect.arrayContaining([ - { ...answer1, id: expect.any(String), fieldId: fieldsInput[0].id, proposalId: proposal.id, type: 'short_text' } + expect.objectContaining({ + ...answer1, + id: expect.any(String), + fieldId: fieldsInput[0].id, + proposalId: proposal.id, + type: 'short_text' + }) ]) ); @@ -225,13 +261,13 @@ describe('upsertFormAnswers', () => { expect(updated2).toEqual( expect.arrayContaining([ - { + expect.objectContaining({ ...updatedAnswer, id: expect.any(String), fieldId: fieldsInput[0].id, proposalId: proposal.id, type: 'short_text' - } + }) ]) ); });