CoolFace
Apppublic

opusdev/vector-similarity-api

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes
index.spec.ts28 linesDownload Raw Back to src
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});28