source: node_modules/simple-update-notifier/src/index.spec.ts@ 81bc7da

finki-main main
Last change on this file since 81bc7da was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago

Initial commit

  • Property mode set to 100644
File size: 744 bytes
RevLine 
[81bc7da]1import simpleUpdateNotifier from '.';
2import hasNewVersion from './hasNewVersion';
3
4const consoleSpy = jest.spyOn(console, 'error');
5
6jest.mock('./hasNewVersion', () => jest.fn().mockResolvedValue('2.0.0'));
7
8beforeEach(jest.clearAllMocks);
9
10test('it logs message if update is available', async () => {
11 await simpleUpdateNotifier({
12 pkg: { name: 'test', version: '1.0.0' },
13 alwaysRun: true,
14 });
15
16 expect(consoleSpy).toHaveBeenCalledTimes(1);
17});
18
19test('it does not log message if update is not available', async () => {
20 (hasNewVersion as jest.Mock).mockResolvedValue(false);
21 await simpleUpdateNotifier({
22 pkg: { name: 'test', version: '2.0.0' },
23 alwaysRun: true,
24 });
25
26 expect(consoleSpy).toHaveBeenCalledTimes(0);
27});
Note: See TracBrowser for help on using the repository browser.