Skip to content

Commit

Permalink
chore(testing): use Date constructor to save original date
Browse files Browse the repository at this point in the history
  • Loading branch information
mdlufy committed Nov 29, 2024
1 parent 2103981 commit 524f573
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"useLightClient": false,
"namedInputs": {
"sharedGlobals": [
"{workspaceRoot}/project/testing/**/*.ts",
"{workspaceRoot}/projects/testing/**/*.ts",
"{workspaceRoot}/nx.json",
"{workspaceRoot}/package-lock.json",
"{workspaceRoot}/tsconfig.*.json",
Expand Down
4 changes: 2 additions & 2 deletions projects/testing/setup-jest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class TransferMockEvent {
global.DragEvent = TransferMockEvent as unknown as typeof DragEvent;
global.ClipboardEvent = TransferMockEvent as unknown as typeof ClipboardEvent;

const originalDate = global.Date;
class OriginalDate extends Date {}

class MockDate extends Date {
constructor() {
Expand All @@ -155,7 +155,7 @@ beforeAll(() => {
});

afterAll(() => {
global.Date = originalDate;
global.Date = OriginalDate as unknown as DateConstructor;
});

/**
Expand Down

0 comments on commit 524f573

Please sign in to comment.