Skip to content

Commit

Permalink
fix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
abailly-akamai committed Dec 4, 2024
1 parent 4e96279 commit 33438f1
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions packages/manager/src/features/Betas/BetaDetails.test.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,32 @@
import { DateTime } from 'luxon';
import * as React from 'react';

import { formatDate } from 'src/utilities/formatDate';
import { renderWithThemeAndRouter } from 'src/utilities/testHelpers';

import BetaDetails from './BetaDetails';

describe('BetaDetails', () => {
beforeAll(() => {
vi.useFakeTimers({
shouldAdvanceTime: true,
});
});
afterAll(() => {
vi.useRealTimers();
});

it('should be able to display all fields for an AccountBeta type', async () => {
const date = new Date(2024, 9, 1);

vi.useFakeTimers();
vi.setSystemTime(date);

const dates = {
ended: DateTime.now().minus({ days: 30 }),
started: DateTime.now().minus({ days: 60 }),
ended: '2024-10-28T09:44:08.593-04:00',
started: '2024-09-28T09:44:08.593-04:00',
};
const beta = {
description: 'A cool beta program',
ended: dates.ended.toISO(),
ended: dates.ended,
id: 'beta',
label: 'Beta',
more_info: 'https://linode.com',
started: dates.started.toISO(),
started: dates.started,
};

const { getByText } = await renderWithThemeAndRouter(
<BetaDetails beta={beta} dataQA="beta-details" />
);
getByText(RegExp(beta.label));
getByText(RegExp(dates.started.toISODate()));
getByText(RegExp(dates.ended.toISODate()));
getByText(formatDate(dates.started, { format: 'yyyy-MM-dd' }));
getByText(formatDate(dates.ended, { format: 'yyyy-MM-dd' }));
getByText(RegExp(beta.description));
});

Expand Down

0 comments on commit 33438f1

Please sign in to comment.