Skip to content

Commit

Permalink
use mock Date.now
Browse files Browse the repository at this point in the history
  • Loading branch information
jjarvisp committed Dec 19, 2024
1 parent 1cd1b31 commit 84bed81
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core/__tests__/libraryUtils.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { isTokenExpired } from '../src/libraryUtils';

describe('isTokenExpired', () => {
const mockDate = Date.now();
jest.spyOn(Date, 'now').mockImplementation(() => mockDate);

it('should return true when token is expired', () => {
const result = isTokenExpired({
expiresAt: Date.now() - 1,
Expand Down

0 comments on commit 84bed81

Please sign in to comment.