main
|
Last change
on this file since 2d1ec46 was 81bc7da, checked in by Klimentina Efremova <klimentina08642@…>, 3 months ago |
|
Initial commit
|
-
Property mode
set to
100644
|
|
File size:
744 bytes
|
| Rev | Line | |
|---|
| [81bc7da] | 1 | import simpleUpdateNotifier from '.';
|
|---|
| 2 | import hasNewVersion from './hasNewVersion';
|
|---|
| 3 |
|
|---|
| 4 | const consoleSpy = jest.spyOn(console, 'error');
|
|---|
| 5 |
|
|---|
| 6 | jest.mock('./hasNewVersion', () => jest.fn().mockResolvedValue('2.0.0'));
|
|---|
| 7 |
|
|---|
| 8 | beforeEach(jest.clearAllMocks);
|
|---|
| 9 |
|
|---|
| 10 | test('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 |
|
|---|
| 19 | test('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.