This repository has been archived on 2026-05-05. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Web-Dev-Old/nodeJS/Learning/01/node_modules/simple-update-notifier/src/cache.spec.ts
2024-11-27 15:08:17 +00:00

18 lines
527 B
TypeScript

import { createConfigDir, getLastUpdate, saveLastUpdate } from './cache';
createConfigDir();
jest.useFakeTimers().setSystemTime(new Date('2022-01-01'));
const fakeTime = new Date('2022-01-01').getTime();
test('can save update then get the update details', () => {
saveLastUpdate('test');
expect(getLastUpdate('test')).toBe(fakeTime);
});
test('prefixed module can save update then get the update details', () => {
saveLastUpdate('@alexbrazier/test');
expect(getLastUpdate('@alexbrazier/test')).toBe(fakeTime);
});