|
1 | 1 | import { fireEvent, screen, waitFor, within } from '@testing-library/react'; |
2 | | -import { addDays, roundToNearestMinutes } from 'date-fns'; |
3 | 2 | import { AxiosResponse } from 'axios'; |
| 3 | +import { addDays, roundToNearestMinutes, startOfDay } from 'date-fns'; |
4 | 4 |
|
| 5 | +import { ResponseWithObject } from 'api'; |
| 6 | +import * as apiFunctions from 'modules/Dashboard/api'; |
5 | 7 | 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'; |
9 | 8 | 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'; |
13 | 11 | 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'; |
16 | 14 | 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'; |
18 | 18 |
|
19 | | -import { ExportDataExported, ExportDateType } from './ExportDataSetting.types'; |
20 | 19 | import { ExportDataSetting } from './ExportDataSetting'; |
| 20 | +import { ExportDataExported, ExportDateType } from './ExportDataSetting.types'; |
21 | 21 |
|
22 | 22 | const createdDate = '2023-11-14T14:43:33.369902'; |
23 | 23 |
|
@@ -160,11 +160,11 @@ describe('ExportDataSetting', () => { |
160 | 160 |
|
161 | 161 | describe('should pass settings specified in settings popup to the export popup', () => { |
162 | 162 | 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'} |
168 | 168 | `('$description', async ({ exportType, expectedFromTime }) => { |
169 | 169 | const mockOnClose = jest.fn(); |
170 | 170 |
|
|
0 commit comments