Skip to content

Commit

Permalink
feat: ✨ add window.confirm and mock crypto.randomUUID for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonWarrenUK committed Dec 4, 2024
1 parent ae3104d commit 9c94429
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@ Object.defineProperty(window, 'alert', {
writable: true,
value: jest.fn(),
});

Object.defineProperty(window, 'confirm', {
writable: true,
value: jest.fn(),
});

// Mock crypto.randomUUID
Object.defineProperty(global.crypto, 'randomUUID', {
writable: true,
value: jest.fn(() => '123e4567-e89b-12d3-a456-426614174000'),
});

0 comments on commit 9c94429

Please sign in to comment.