Test fix - increase test regex matching (#16055)

Fix a broken datetime-based test

- [x] Manual QA for all new/changed functionality

Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
This commit is contained in:
Jacob Shandling 2024-01-11 11:33:14 -08:00 committed by GitHub
parent 7c84588689
commit 9ee03b5c5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,8 @@ import { render, screen } from "@testing-library/react";
import ReportUpdatedCell from "./ReportUpdatedCell";
const HUMAN_READABLE_DATETIME_REGEX = /\d{1,2}\/{1,2}\d\/\d\d\d\d, \d{1,2}:\d{1,2}:\d{1,2}\s(A|P)M/;
describe("ReportUpdatedCell component", () => {
it("Renders '---' with tooltip and no link when run on an interval with discard data and automations enabled", () => {
render(
@ -48,9 +50,7 @@ describe("ReportUpdatedCell component", () => {
/>
);
expect(
screen.getByText(/\d\d\/\d\d\/\d\d\d\d, \d{1,2}:\d{1,2}:\d{1,2}( AM|PM)?/)
).toBeInTheDocument();
expect(screen.getByText(HUMAN_READABLE_DATETIME_REGEX)).toBeInTheDocument();
expect(screen.getByText(/\d+.+ago/)).toBeInTheDocument();
expect(screen.getByText(/View report/)).toBeInTheDocument();
});
@ -67,9 +67,7 @@ describe("ReportUpdatedCell component", () => {
/>
);
expect(
screen.getByText(/\d\d\/\d\d\/\d\d\d\d, \d{1,2}:\d{1,2}:\d{1,2}( AM|PM)?/)
).toBeInTheDocument();
expect(screen.getByText(HUMAN_READABLE_DATETIME_REGEX)).toBeInTheDocument();
expect(screen.getByText(/\d+.+ago/)).toBeInTheDocument();
expect(screen.getByText(/View report/)).toBeInTheDocument();
});