Files
med-notes/.pnpm-store/v10/files/e3/a714772b9c84141936dc93091ebe19ce26b608618862fc119a0923e4d4788a93fc095dc459e8a26f7db6494bfd3a640fb176951a32a34453d7cdc4f292ee06
2025-06-26 03:35:15 +00:00

28 lines
744 B
Plaintext

import simpleUpdateNotifier from '.';
import hasNewVersion from './hasNewVersion';
const consoleSpy = jest.spyOn(console, 'error');
jest.mock('./hasNewVersion', () => jest.fn().mockResolvedValue('2.0.0'));
beforeEach(jest.clearAllMocks);
test('it logs message if update is available', async () => {
await simpleUpdateNotifier({
pkg: { name: 'test', version: '1.0.0' },
alwaysRun: true,
});
expect(consoleSpy).toHaveBeenCalledTimes(1);
});
test('it does not log message if update is not available', async () => {
(hasNewVersion as jest.Mock).mockResolvedValue(false);
await simpleUpdateNotifier({
pkg: { name: 'test', version: '2.0.0' },
alwaysRun: true,
});
expect(consoleSpy).toHaveBeenCalledTimes(0);
});