feat: add mobile shell and unified search
Some checks failed
ci / 정본·보안·린트·타입·테스트 (push) Failing after 50s
ci / 워크스페이스 빌드 검증 (push) Has been skipped
ci / Supabase Edge Functions + Cloudflare Worker (push) Successful in 20s
ci / .NET API 서버 테스트 (push) Successful in 12s
deploy-site / deploy (push) Successful in 39s
ci / 모바일 린트·타입·Jest (push) Failing after 3h10m31s

This commit is contained in:
Yun Chan 2026-09-28 23:23:36 +09:00
parent f505a03d34
commit 5ca3709b32
98 changed files with 5168 additions and 2093 deletions

View file

@ -0,0 +1,66 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { ErrorCode } from '@d3ro/core/errors'
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
const handlers = vi.hoisted(
() => new Map<string, (event: unknown, params: unknown) => unknown>()
)
const search = vi.hoisted(() => vi.fn())
vi.mock('electron', () => ({
ipcMain: {
handle: vi.fn((channel: string, handler: (event: unknown, params: unknown) => unknown) => {
handlers.set(channel, handler)
}),
},
}))
vi.mock('../../../src/main/services/UnifiedSearchService', async (importOriginal) => {
const actual = await importOriginal<typeof import('../../../src/main/services/UnifiedSearchService')>()
return {
...actual,
getUnifiedSearchService: () => ({ search }),
}
})
beforeEach(async () => {
vi.clearAllMocks()
handlers.clear()
const mod = await import('../../../src/main/ipc/unified-search-handlers')
mod.registerUnifiedSearchHandlers()
})
describe('UNIFIED_SEARCH.QUERY', () => {
it.each([
null,
{},
{ query: 42 },
{ query: '계획', limit: Number.NaN },
{ query: '계획', limit: Number.NEGATIVE_INFINITY },
])('returns ConfigInvalidValue for malformed renderer input: %o', async (params) => {
const handler = handlers.get(IPC_CHANNELS.UNIFIED_SEARCH.QUERY)
if (!handler) throw new Error('unified search handler was not registered')
const result = await handler({}, params)
expect(result).toMatchObject({
success: false,
error: { code: ErrorCode.ConfigInvalidValue },
})
expect(search).not.toHaveBeenCalled()
})
it('passes validated input to the service and returns IPC success', async () => {
const handler = handlers.get(IPC_CHANNELS.UNIFIED_SEARCH.QUERY)
if (!handler) throw new Error('unified search handler was not registered')
search.mockReturnValue({ query: '계획', results: [], total: 0 })
const result = await handler({}, { query: '계획', limit: 10 })
expect(search).toHaveBeenCalledWith({ query: '계획', limit: 10 })
expect(result).toEqual({
success: true,
data: { query: '계획', results: [], total: 0 },
})
})
})