Skip to content

Commit

Permalink
fix answers test (#5151)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcasey authored Jan 9, 2025
1 parent fddec73 commit 0446bd9
Showing 1 changed file with 44 additions and 8 deletions.
52 changes: 44 additions & 8 deletions lib/proposals/forms/__tests__/upsertProposalFormAnswers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ describe('upsertFormAnswers', () => {

expect(updated1).toEqual<FormFieldAnswer[]>(
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'
})
])
);

Expand All @@ -95,8 +101,20 @@ describe('upsertFormAnswers', () => {

expect(updated2).toEqual<FormFieldAnswer[]>(
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'
})
])
);
});
Expand Down Expand Up @@ -154,8 +172,20 @@ describe('upsertFormAnswers', () => {

expect(updated1).toEqual<FormFieldAnswer[]>(
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'
})
])
);
});
Expand Down Expand Up @@ -208,7 +238,13 @@ describe('upsertFormAnswers', () => {

expect(updated1).toEqual<FormFieldAnswer[]>(
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'
})
])
);

Expand All @@ -225,13 +261,13 @@ describe('upsertFormAnswers', () => {

expect(updated2).toEqual<FormFieldAnswer[]>(
expect.arrayContaining([
{
expect.objectContaining({
...updatedAnswer,
id: expect.any(String),
fieldId: fieldsInput[0].id,
proposalId: proposal.id,
type: 'short_text'
}
})
])
);
});
Expand Down

0 comments on commit 0446bd9

Please sign in to comment.