Skip to content

Commit bdc5c00

Browse files
committed
test: Update data export modal tests to match new normalized from/to dates
1 parent d28d384 commit bdc5c00

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

src/shared/features/AppletSettings/ExportDataSetting/ExportDataSetting.test.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import { fireEvent, screen, waitFor, within } from '@testing-library/react';
2-
import { addDays, roundToNearestMinutes } from 'date-fns';
32
import { AxiosResponse } from 'axios';
3+
import { addDays, roundToNearestMinutes, startOfDay } from 'date-fns';
44

5+
import { ResponseWithObject } from 'api';
6+
import * as apiFunctions from 'modules/Dashboard/api';
57
import { initialStateData } from 'redux/modules';
6-
import { mockedApplet, mockedPassword } from 'shared/mock';
7-
import { renderWithProviders } from 'shared/utils/renderWithProviders';
8-
import * as encryptionFunctions from 'shared/utils/encryption';
98
import { useFeatureFlags } from 'shared/hooks/useFeatureFlags';
10-
import * as apiFunctions from 'modules/Dashboard/api';
11-
import { mockSuccessfulHttpResponse } from 'shared/utils/axios-mocks';
12-
import { ResponseWithObject } from 'api';
9+
import { mockedApplet, mockedPassword } from 'shared/mock';
10+
import { getPreloadedState } from 'shared/tests/getPreloadedState';
1311
import { ExportDataResult } from 'shared/types';
14-
import * as ScheduleHistoryExporterClasses from 'shared/utils/exportData/exporters/ScheduleHistoryExporter';
15-
import * as FlowActivityHistoryExporterClasses from 'shared/utils/exportData/exporters/FlowActivityHistoryExporter';
12+
import { mockSuccessfulHttpResponse } from 'shared/utils/axios-mocks';
13+
import * as encryptionFunctions from 'shared/utils/encryption';
1614
import * as EHRDataExporterClasses from 'shared/utils/exportData/exporters/EHRDataExporter';
17-
import { getPreloadedState } from 'shared/tests/getPreloadedState';
15+
import * as FlowActivityHistoryExporterClasses from 'shared/utils/exportData/exporters/FlowActivityHistoryExporter';
16+
import * as ScheduleHistoryExporterClasses from 'shared/utils/exportData/exporters/ScheduleHistoryExporter';
17+
import { renderWithProviders } from 'shared/utils/renderWithProviders';
1818

19-
import { ExportDataExported, ExportDateType } from './ExportDataSetting.types';
2019
import { ExportDataSetting } from './ExportDataSetting';
20+
import { ExportDataExported, ExportDateType } from './ExportDataSetting.types';
2121

2222
const createdDate = '2023-11-14T14:43:33.369902';
2323

@@ -160,11 +160,11 @@ describe('ExportDataSetting', () => {
160160

161161
describe('should pass settings specified in settings popup to the export popup', () => {
162162
test.each`
163-
exportType | expectedFromTime | description
164-
${ExportDateType.AllTime} | ${new Date(createdDate)} | ${'use applet create time and now for all time'}
165-
${ExportDateType.Last24h} | ${addDays(new Date(), -1)} | ${'use correct dates for last 24h'}
166-
${ExportDateType.LastWeek} | ${addDays(new Date(), -7)} | ${'use correct dates for last week'}
167-
${ExportDateType.LastMonth} | ${addDays(new Date(), -30)} | ${'use correct dates for last month'}
163+
exportType | expectedFromTime | description
164+
${ExportDateType.AllTime} | ${startOfDay(new Date(createdDate))} | ${'use normalized applet create time for all time'}
165+
${ExportDateType.Last24h} | ${addDays(new Date(), -1)} | ${'use correct dates for last 24h'}
166+
${ExportDateType.LastWeek} | ${startOfDay(addDays(new Date(), -7))} | ${'use normalized dates for last week'}
167+
${ExportDateType.LastMonth} | ${startOfDay(addDays(new Date(), -30))} | ${'use normalized dates for last month'}
168168
`('$description', async ({ exportType, expectedFromTime }) => {
169169
const mockOnClose = jest.fn();
170170

0 commit comments

Comments
 (0)