Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanjduffy committed Nov 20, 2023
1 parent ccc0003 commit 8d11216
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
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

0 comments on commit 8d11216

Please sign in to comment.