diff --git a/locust/webui/src/pages/tests/HtmlReport.test.tsx b/locust/webui/src/pages/tests/HtmlReport.test.tsx index 28543b3cdb..2834745870 100644 --- a/locust/webui/src/pages/tests/HtmlReport.test.tsx +++ b/locust/webui/src/pages/tests/HtmlReport.test.tsx @@ -3,6 +3,7 @@ import { describe, expect, test } from 'vitest'; import HtmlReport from 'pages/HtmlReport'; import { swarmReportMock } from 'test/mocks/swarmState.mock'; +import { formatLocalDate } from 'utils/date'; describe('HtmlReport', () => { test('renders a report', () => { @@ -15,10 +16,21 @@ describe('HtmlReport', () => { expect(getByRole('heading', { name: 'Final ratio' })).toBeTruthy(); expect(getByRole('link', { name: 'Download the Report' })); expect(getByText(swarmReportMock.locustfile)).toBeTruthy(); - expect(getByText(`${swarmReportMock.startTime} - ${swarmReportMock.endTime}`)).toBeTruthy(); expect(getByText(swarmReportMock.host)).toBeTruthy(); }); + test('formats the start and end time as expected', () => { + const { getByText } = render(); + + expect( + getByText( + `${formatLocalDate(swarmReportMock.startTime)} - ${formatLocalDate( + swarmReportMock.endTime, + )}`, + ), + ).toBeTruthy(); + }); + test('does not render the download link when showDownloadLink is false', () => { const { queryByRole } = render();