Skip to content

Commit

Permalink
ADM-831:[frontend]feat: add pipeline is future time check (#1112)
Browse files Browse the repository at this point in the history
* ADM-831:[frontend]test: update time mock

* ADM-831:[frontend]test: rename test
  • Loading branch information
weiraneve authored Mar 5, 2024
1 parent 92a6df0 commit 213b20a
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions frontend/__tests__/containers/MetricsStep/MetricsStep.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,14 @@ describe('MetricsStep', () => {
).toBeInTheDocument();
});

it('should render no pipeline container when get pipeline when selected future time ', async () => {
it('should render no pipeline container given now is 2024-01-01 when get pipeline when selected future time ', async () => {
const MOCK_FUTURE_DATE_RANGE = {
startDate: '2034-04-04T00:00:00+08:00',
endDate: '2034-04-18T00:00:00+08:00',
startDate: '2024-02-04T00:00:00+08:00',
endDate: '2024-02-18T00:00:00+08:00',
};

jest.useFakeTimers().setSystemTime(new Date('2024-01-01'));

store.dispatch(updateDateRange(MOCK_FUTURE_DATE_RANGE));

setup();
Expand All @@ -322,21 +324,27 @@ describe('MetricsStep', () => {
'Please go back to the previous page and change your collection date, or check your pipeline info!',
),
).toBeInTheDocument();

jest.useRealTimers();
});

it('should render pipeline container when get pipeline when selected past time ', async () => {
it('should render pipeline container given now is 2024-01-01 when get pipeline when selected past time ', async () => {
const MOCK_PAST_DATE_RANGE = {
startDate: '2014-04-04T00:00:00+08:00',
endDate: '2014-04-18T00:00:00+08:00',
};

jest.useFakeTimers().setSystemTime(new Date('2024-01-01'));

store.dispatch(updateDateRange(MOCK_PAST_DATE_RANGE));

setup();

await waitFor(() => {
expect(screen.getByText('Pipeline settings')).toBeInTheDocument();
});

jest.useRealTimers();
});

it('should be render form container when got board card success', async () => {
Expand Down

0 comments on commit 213b20a

Please sign in to comment.