슬래시 제외 줄 상태 갱신 분리

This commit is contained in:
2026-07-27 11:40:50 +09:00
parent 3515cf0ccf
commit a39944b139
7 changed files with 66 additions and 12 deletions

View File

@@ -1,12 +1,14 @@
import assert from 'node:assert/strict'
import test from 'node:test'
import {
addSlashSuppressedLine,
getMediaPickerKindFromSlashAction,
getSlashCommandFocusTarget,
getSlashCommandTextareaSelection,
insertMarkdownLinesAtSlashTarget,
isMediaSlashAction,
parseSlashInput,
removeSlashSuppressedLine,
resolveSlashCommand,
shouldIgnorePendingMediaSlashCommit
} from '../lib/markdown-slash-commands.js'
@@ -48,6 +50,23 @@ test('미디어 슬래시 명령 지연 commit은 같은 줄 slash 원문일 때
}), false)
})
test('슬래시 제외 줄 Set은 기존 값을 보존한 새 Set으로 갱신한다', () => {
const source = new Set([1, 2])
const added = addSlashSuppressedLine(source, 3)
const removed = removeSlashSuppressedLine(added, 2)
assert.deepEqual([...source], [1, 2])
assert.deepEqual([...added], [1, 2, 3])
assert.deepEqual([...removed], [1, 3])
assert.notEqual(added, source)
assert.notEqual(removed, added)
})
test('슬래시 제외 줄 Set은 유효하지 않은 줄 번호를 무시한다', () => {
assert.deepEqual([...addSlashSuppressedLine(new Set([1]), Number.NaN)], [1])
assert.deepEqual([...removeSlashSuppressedLine(new Set([1]), Number.NaN)], [1])
})
test('슬래시 명령 줄에 미디어를 삽입할 때 원문 줄을 교체한다', () => {
const markdown = [
'첫 줄',