Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit tests #277

Merged
merged 2 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`formatAllRecordingsHumanReadable formats one basic recording 1`] = `
"ID Status Title Created At
1 onDisk 2020-01-01T00:00:00.000Z"
"ID Status Title Created
1 onDisk 2 days ago"
`;

exports[`formatAllRecordingsHumanReadable sorts recording by createTime, most recent recording first 1`] = `
"ID Status Title Created At
2 onDisk Replay of test 2020-01-02T00:00:00.000Z
1 onDisk Replay of test 2020-01-01T00:00:00.000Z"
"ID Status Title Created
2 onDisk Replay of test 1 day ago
1 onDisk Replay of test 2 days ago"
`;

exports[`formatAllRecordingsHumanReadable uses the metadata title when it exists 1`] = `
"ID Status Title Created At
1 onDisk A Node Recording 2020-01-01T00:00:00.000Z"
"ID Status Title Created
1 onDisk A Node Recording 2 days ago"
`;

exports[`formatAllReordingsJson matches snapshot 1`] = `
Expand Down
9 changes: 9 additions & 0 deletions packages/replay/src/cli/formatRecordings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ import { ExternalRecordingEntry } from "../types";
import { formatAllRecordingsHumanReadable, formatAllRecordingsJson } from "./formatRecordings";

describe("formatAllRecordingsHumanReadable", () => {
let now = Date.now;
beforeEach(() => {
Date.now = jest.fn(() => new Date("2020-01-03").getTime());
});

afterEach(() => {
Date.now = now;
});

it("formats one basic recording", () => {
const recordings: ExternalRecordingEntry[] = [
{
Expand Down
Loading