The tree carried uncommitted work from several areas (web push, mobile screens, admin charts, test-hygiene cleanup, CI and map docs). It is landed as one commit so the release pipeline can start from a clean tree; the desktop transcript-correction behaviour shipped in the previous commit and is unchanged here.
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
|
const mocks = vi.hoisted(() => ({
|
|
askConsent: vi.fn(async () => 'later' as const),
|
|
askRestart: vi.fn(async () => 'later' as const),
|
|
}))
|
|
|
|
vi.mock('../../src/main/services/update-adapters', () => ({
|
|
createDialogPrompter: () => ({
|
|
askConsent: mocks.askConsent,
|
|
askRestart: mocks.askRestart,
|
|
}),
|
|
}))
|
|
|
|
import {
|
|
UPDATE_DIALOG_PREVIEW_ARG,
|
|
isUpdateDialogPreviewRequested,
|
|
runUpdateDialogPreview,
|
|
} from '../../src/main/update-dialog-preview'
|
|
|
|
describe('update dialog native preview', () => {
|
|
beforeEach(() => {
|
|
mocks.askConsent.mockClear()
|
|
mocks.askRestart.mockClear()
|
|
})
|
|
|
|
it('명시적 인자가 있을 때만 활성화된다', () => {
|
|
expect(isUpdateDialogPreviewRequested(['electron', '.'])).toBe(false)
|
|
expect(isUpdateDialogPreviewRequested(['D3RO Voice.exe', UPDATE_DIALOG_PREVIEW_ARG])).toBe(true)
|
|
})
|
|
|
|
it('optional/mandatory consent와 restart dialog를 각각 한 번씩 보여 준다', async () => {
|
|
await runUpdateDialogPreview()
|
|
|
|
expect(mocks.askConsent).toHaveBeenNthCalledWith(1, {
|
|
version: '99.0.0-preview',
|
|
releaseNotes: undefined,
|
|
mandatory: false,
|
|
})
|
|
expect(mocks.askConsent).toHaveBeenNthCalledWith(2, {
|
|
version: '99.0.0-preview',
|
|
releaseNotes: undefined,
|
|
mandatory: true,
|
|
})
|
|
expect(mocks.askRestart).toHaveBeenNthCalledWith(1, '99.0.0-preview', { mandatory: false })
|
|
expect(mocks.askRestart).toHaveBeenNthCalledWith(2, '99.0.0-preview', { mandatory: true })
|
|
})
|
|
})
|