관리자 슬래시 명령 적용 계획 분리
This commit is contained in:
@@ -3,6 +3,7 @@ import test from 'node:test'
|
||||
import {
|
||||
addSlashSuppressedLine,
|
||||
clampSlashHighlightedIndex,
|
||||
createSlashCommandApplyPlan,
|
||||
getMediaPickerKindFromSlashAction,
|
||||
getNextSlashHighlightedIndex,
|
||||
getSlashCommandFocusTarget,
|
||||
@@ -35,6 +36,56 @@ test('정확한 슬래시 명령과 미디어 액션을 판별한다', () => {
|
||||
assert.equal(getMediaPickerKindFromSlashAction('lines'), '')
|
||||
})
|
||||
|
||||
test('슬래시 명령 적용 계획은 미디어와 줄 삽입을 구분한다', () => {
|
||||
assert.deepEqual(createSlashCommandApplyPlan({
|
||||
command: resolveSlashCommand('image'),
|
||||
sourceLine: 2
|
||||
}), {
|
||||
kind: 'media',
|
||||
line: 2,
|
||||
mediaKind: 'image'
|
||||
})
|
||||
|
||||
const headingPlan = createSlashCommandApplyPlan({
|
||||
command: resolveSlashCommand('h2'),
|
||||
sourceLine: 4
|
||||
})
|
||||
|
||||
assert.deepEqual(headingPlan, {
|
||||
kind: 'lines',
|
||||
line: 4,
|
||||
lines: ['## ']
|
||||
})
|
||||
assert.notEqual(headingPlan.lines, resolveSlashCommand('h2')?.lines)
|
||||
})
|
||||
|
||||
test('슬래시 명령 적용 계획은 적용할 수 없는 입력을 무시한다', () => {
|
||||
assert.deepEqual(createSlashCommandApplyPlan({
|
||||
command: null,
|
||||
sourceLine: 1
|
||||
}), {
|
||||
kind: 'none'
|
||||
})
|
||||
assert.deepEqual(createSlashCommandApplyPlan({
|
||||
command: resolveSlashCommand('image'),
|
||||
sourceLine: null
|
||||
}), {
|
||||
kind: 'none'
|
||||
})
|
||||
assert.deepEqual(createSlashCommandApplyPlan({
|
||||
command: {
|
||||
id: 'broken',
|
||||
label: '깨진 명령',
|
||||
description: '',
|
||||
keywords: [],
|
||||
action: 'unknown'
|
||||
},
|
||||
sourceLine: 1
|
||||
}), {
|
||||
kind: 'none'
|
||||
})
|
||||
})
|
||||
|
||||
test('미디어 슬래시 명령 지연 commit은 같은 줄 slash 원문일 때만 무시한다', () => {
|
||||
assert.equal(shouldIgnorePendingMediaSlashCommit({
|
||||
pendingInsertLine: 3,
|
||||
|
||||
Reference in New Issue
Block a user