refactor(desktop): structure suggestion pipeline and restore test gates
This commit is contained in:
parent
fe0989c456
commit
1d4f8d8401
17 changed files with 813 additions and 569 deletions
|
|
@ -559,30 +559,30 @@ describe('입력 플로우 서비스', () => {
|
|||
it('세대가 달라진 로컬 후보는 게시하지 않아 명시 취소 뒤 되살아나지 않는다', () => {
|
||||
const service = getSuggestionService() as unknown as {
|
||||
_generationToken: number
|
||||
_publishLocalMemory: (
|
||||
prefix: string,
|
||||
context: Parameters<ReturnType<typeof getSuggestionService>['handleTypingContext']>[0],
|
||||
maxCandidates: number,
|
||||
maxChars: number,
|
||||
latencyMs: number,
|
||||
_publishLocalMemory: (publication: {
|
||||
prefix: string
|
||||
context: Parameters<ReturnType<typeof getSuggestionService>['handleTypingContext']>[0]
|
||||
maxCandidates: number
|
||||
maxChars: number
|
||||
latencyMs: number
|
||||
token: number
|
||||
) => boolean
|
||||
}) => boolean
|
||||
}
|
||||
service._generationToken = 2
|
||||
|
||||
expect(
|
||||
service._publishLocalMemory(
|
||||
'오늘 회의 결과를',
|
||||
{
|
||||
service._publishLocalMemory({
|
||||
prefix: '오늘 회의 결과를',
|
||||
context: {
|
||||
prefix: '오늘 회의 결과를', fullText: '', caretOffset: null, anchor: null, anchorKind: null, isPassword: false,
|
||||
isEditable: true, isComposing: false, hasSelection: false, available: true, appName: 'Notion.exe', windowTitle: null,
|
||||
idleMs: 300, capturedAt: now, editedSinceFocus: true, typedRecently: true
|
||||
},
|
||||
3,
|
||||
160,
|
||||
0,
|
||||
1
|
||||
)
|
||||
maxCandidates: 3,
|
||||
maxChars: 160,
|
||||
latencyMs: 0,
|
||||
token: 1
|
||||
})
|
||||
).toBe(false)
|
||||
expect(getSuggestionService().getState().visible).toBe(false)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -133,8 +133,7 @@ describe('입력 중 늦게 도착하는 UIA 스냅샷', () => {
|
|||
it.each([
|
||||
['마우스 클릭', (value: Internal) => value._handleMouseDown({ x: 2, y: 3, button: 1 })],
|
||||
['선택 드래그 끝', (value: Internal) => value._handleMouseUp({ x: 2, y: 3 })],
|
||||
['스크롤', (value: Internal) => value._handleWheel({ rotation: 1 })],
|
||||
['합성 유니코드 키', (value: Internal) => value._handleKeyDown({ keycode: 0 })]
|
||||
['스크롤', (value: Internal) => value._handleWheel({ rotation: 1 })]
|
||||
] as const)('%s 중 도착한 응답은 버린다', async (_name, change) => {
|
||||
const delayed = pending()
|
||||
change(internal)
|
||||
|
|
@ -143,6 +142,14 @@ describe('입력 중 늦게 도착하는 UIA 스냅샷', () => {
|
|||
expect(publish).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('합성 유니코드 키는 사용자 입력으로 오인하지 않고 진행 중 응답을 유지한다', async () => {
|
||||
const delayed = pending()
|
||||
internal._handleKeyDown({ keycode: 0 })
|
||||
delayed.resolve(snapshot())
|
||||
expect((await delayed.request)?.prefix).toBe('안녕하세요')
|
||||
expect(publish).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
it('통계에서 제외한 프로그램 백스페이스도 스냅샷을 무효화한다', async () => {
|
||||
service.expectProgrammaticKeys(1)
|
||||
const delayed = pending()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue