chore: land in-progress workspace changes before 1.16.2

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.
This commit is contained in:
Yun Chan 2026-11-05 21:58:44 +09:00
parent 9c2b6a9782
commit 7fe49c437e
144 changed files with 3760 additions and 4523 deletions

View file

@ -0,0 +1,58 @@
import { describe, expect, it, vi } from 'vitest'
type Listener = (...args: unknown[]) => void
const state = vi.hoisted(() => ({
appListeners: new Map<string, Listener>(),
bootstrap: vi.fn(async () => undefined),
exit: vi.fn(),
preview: vi.fn(async () => undefined),
quit: vi.fn(),
requestSingleInstanceLock: vi.fn(() => true),
setAsDefaultProtocolClient: vi.fn(),
setupLifecycle: vi.fn(),
}))
vi.mock('electron', () => ({
app: {
on: vi.fn((event: string, listener: Listener) => state.appListeners.set(event, listener)),
whenReady: vi.fn(() => Promise.resolve()),
setAsDefaultProtocolClient: state.setAsDefaultProtocolClient,
requestSingleInstanceLock: state.requestSingleInstanceLock,
disableHardwareAcceleration: vi.fn(),
commandLine: { appendSwitch: vi.fn() },
exit: state.exit,
quit: state.quit,
getPath: vi.fn(() => '.'),
},
}))
vi.mock('electron-log', () => ({
default: { error: vi.fn() },
}))
vi.mock('../../src/main/app-identity', () => ({ applyAppIdentity: vi.fn() }))
vi.mock('../../src/main/bootstrap', () => ({ bootstrap: state.bootstrap }))
vi.mock('../../src/main/lifecycle', () => ({ setupLifecycle: state.setupLifecycle }))
vi.mock('../../src/main/windows/WindowManager', () => ({ showMainWindow: vi.fn(() => null) }))
vi.mock('../../src/main/services/LoggerService', () => ({
getLogger: () => ({ info: vi.fn(), warn: vi.fn(), error: vi.fn(), debug: vi.fn() }),
}))
vi.mock('../../src/main/update-dialog-preview', () => ({
isUpdateDialogPreviewRequested: () => true,
runUpdateDialogPreview: state.preview,
}))
describe('update dialog preview entrypoint', () => {
it('protocol/lock/bootstrap을 건드리지 않고 preview 후 종료한다', async () => {
await import('../../src/main/index')
await vi.waitFor(() => expect(state.preview).toHaveBeenCalledTimes(1))
expect(state.setAsDefaultProtocolClient).not.toHaveBeenCalled()
expect(state.requestSingleInstanceLock).not.toHaveBeenCalled()
expect(state.bootstrap).not.toHaveBeenCalled()
expect(state.setupLifecycle).not.toHaveBeenCalled()
expect(state.exit).not.toHaveBeenCalled()
expect(state.quit).toHaveBeenCalledTimes(1)
})
})

View file

@ -0,0 +1,99 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { getI18n } from '@d3ro/i18n'
import { createDialogPrompter } from '../../../src/main/services/update-adapters'
import { getPopupTranslator } from '../../../src/main/windows/WindowManager'
const dialog = vi.hoisted(() => ({ showMessageBox: vi.fn() }))
vi.mock('electron', () => ({
app: { isPackaged: false },
dialog: { showMessageBox: dialog.showMessageBox },
}))
vi.mock('../../../src/main/windows/WindowManager', () => ({
getMainWindow: vi.fn(() => null),
getPopupTranslator: vi.fn(),
}))
describe('업데이트 대화상자 i18n', () => {
beforeEach(() => {
dialog.showMessageBox.mockReset()
vi.mocked(getPopupTranslator).mockReset()
})
it('한국어 일반 다운로드 문구와 버튼 순서를 유지한다', async () => {
vi.mocked(getPopupTranslator).mockReturnValue(getI18n('ko').t)
dialog.showMessageBox.mockResolvedValue({ response: 2 })
const answer = await createDialogPrompter().askConsent({
version: '1.16.1',
releaseNotes: '- 입력 경합 수정',
mandatory: false,
})
expect(answer).toBe('skip')
expect(dialog.showMessageBox).toHaveBeenCalledWith({
type: 'info',
title: '새 버전 업데이트',
message:
'D3RO Voice v1.16.1 새 버전이 출시되었습니다. 지금 다운로드할까요?\n\n[주요 변경사항]\n- 입력 경합 수정',
buttons: ['지금 다운로드', '나중에', getI18n('ko').t('update.dialog.skipVersion')],
defaultId: 0,
cancelId: 1,
})
})
it('영어 필수 재시작 문구도 같은 계약으로 표시한다', async () => {
vi.mocked(getPopupTranslator).mockReturnValue(getI18n('en').t)
dialog.showMessageBox.mockResolvedValue({ response: 0 })
const answer = await createDialogPrompter().askRestart('1.16.1', { mandatory: true })
expect(answer).toBe('restart')
expect(dialog.showMessageBox).toHaveBeenCalledWith({
type: 'warning',
title: 'Required Update',
message:
'Required update D3RO Voice v1.16.1 is ready. The app will restart to install it when you continue.',
buttons: ['Restart & Install Now'],
defaultId: 0,
cancelId: 0,
})
})
it('같은 prompter도 호출 시점의 앱 로케일을 사용한다', async () => {
vi.mocked(getPopupTranslator).mockReturnValue(getI18n('ko').t)
dialog.showMessageBox.mockResolvedValue({ response: 1 })
const prompter = createDialogPrompter()
const consent = await prompter.askConsent({
version: '1.16.1',
mandatory: false,
})
vi.mocked(getPopupTranslator).mockReturnValue(getI18n('en').t)
dialog.showMessageBox.mockResolvedValue({ response: 0 })
const restart = await prompter.askRestart('1.16.1', { mandatory: true })
expect(consent).toBe('later')
expect(restart).toBe('restart')
expect(getPopupTranslator).toHaveBeenCalledTimes(2)
expect(dialog.showMessageBox).toHaveBeenNthCalledWith(1, {
type: 'info',
title: '새 버전 업데이트',
message: 'D3RO Voice v1.16.1 새 버전이 출시되었습니다. 지금 다운로드할까요?',
buttons: ['지금 다운로드', '나중에', '이 버전 건너뛰기'],
defaultId: 0,
cancelId: 1,
})
expect(dialog.showMessageBox).toHaveBeenNthCalledWith(2, {
type: 'warning',
title: 'Required Update',
message:
'Required update D3RO Voice v1.16.1 is ready. The app will restart to install it when you continue.',
buttons: ['Restart & Install Now'],
defaultId: 0,
cancelId: 0,
})
})
})

View file

@ -0,0 +1,48 @@
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 })
})
})