test: add tests for updater.ts

Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com>
This commit is contained in:
google-labs-jules[bot] 2026-07-08 11:39:51 +00:00
parent 955c142daf
commit d90512a433

View file

@ -1,6 +1,7 @@
import { describe, it, expect, vi, beforeEach } from 'vitest'; import { describe, it, expect, vi, beforeEach } from 'vitest';
import { checkForUpdate } from './updater'; import { checkForUpdate } from './updater';
import * as storage from './storage'; import * as storage from './storage';
import type { Update } from '@tauri-apps/plugin-updater';
vi.mock('./storage', () => ({ vi.mock('./storage', () => ({
isTauri: vi.fn(), isTauri: vi.fn(),
@ -62,7 +63,7 @@ describe('checkForUpdate', () => {
version: '1.1.0', version: '1.1.0',
currentVersion: '1.0.0', currentVersion: '1.0.0',
downloadAndInstall: vi.fn().mockResolvedValue(undefined), downloadAndInstall: vi.fn().mockResolvedValue(undefined),
}; } as unknown as Update;
vi.mocked(check).mockResolvedValue(mockUpdate); vi.mocked(check).mockResolvedValue(mockUpdate);
const result = await checkForUpdate(); const result = await checkForUpdate();