Skip to content

Commit

Permalink
test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AntBush committed May 17, 2024
1 parent 3e4c2f2 commit c8adad5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/components/Analyst/History/HistoryContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,11 @@ const HistoryContent = ({ historyItem, prevHistoryItem }) => {
if (tableName === 'application_gis_assessment_hh') {
return (
<div>
<StyledContent data-testid="history-content-form-data">
<StyledContent data-testid="history-content-gis-assessment-hh">
<span>
{displayName}
{' updated the '}
<b>GIS Analysis </b>
<b>GIS Assessment Household Count </b>
</span>
on {createdAtFormatted}
</StyledContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2831,6 +2831,31 @@ const mockQueryPayload = {
sessionSub: 'test-session-sub@idir',
tableName: 'application_project_type',
},
{
applicationId: 1,
createdAt: '2024-01-12T18:27:42.139106+00:00',
externalAnalyst: null,
familyName: 'Bar',
item: null,
givenName: 'Foo',
op: 'INSERT',
record: {
id: 5,
created_at: '2024-01-12T18:27:42.139106+00:00',
created_by: 3,
updated_at: '2024-01-12T18:27:42.139106+00:00',
updated_by: 3,
eligible: 10,
eligible_indigenous: 5,
archived_at: null,
archived_by: null,
application_id: 7,
},
oldRecord: null,
recordId: 'd6431f27-b78d-5212-916d-380e0cce9583',
sessionSub: 'test-session-sub@idir',
tableName: 'application_gis_assessment_hh',
},
],
},
},
Expand Down Expand Up @@ -3044,7 +3069,7 @@ describe('The index page', () => {

const diffTables = screen.getAllByTestId('diff-table');

expect(diffTables.length).toBe(26);
expect(diffTables.length).toBe(27);

diffTables.forEach((table) => {
expect(table).toBeVisible();
Expand All @@ -3062,6 +3087,17 @@ describe('The index page', () => {
);
});

it('shows the correct history for gis assessment hh', async () => {
pageTestingHelper.loadQuery();
pageTestingHelper.renderPage();

expect(
screen.getAllByTestId('history-content-gis-assessment-hh')[0]
).toHaveTextContent(
'Foo Bar updated the GIS Assessment Household Count on Jan 12, 2024, 10:27 a.m.'
);
});

it('shows the correct history for change request', async () => {
pageTestingHelper.loadQuery();
pageTestingHelper.renderPage();
Expand Down

0 comments on commit c8adad5

Please sign in to comment.