This commit is contained in:
2026-10-18 01:38:02 +07:00
parent 7f2a02b69f
commit b591287072
16 changed files with 1308 additions and 52 deletions
+24
View File
@@ -0,0 +1,24 @@
import assert from 'node:assert/strict'
import { test } from 'node:test'
import { parsePlan } from './screen-plan.js'
test('план: режимы protobuf, значения по умолчанию и UTF-8 ограничения сервера', () => {
assert.deepEqual(parsePlan(null), { steps: [], currentStep: 0 })
assert.equal(
parsePlan({ steps: [{ mode: 'SCREEN_MODE_TIMER', timerDurationSeconds: '60' }] }).steps[0]
?.timerLabel,
'Перерыв',
)
for (const value of [
{ steps: {} },
{ steps: [{ mode: 0 }] },
{ steps: [{ mode: 9 }] },
{ steps: [{ mode: 8, text: ' ' }] },
{ steps: [{ mode: 8, text: 'Я'.repeat(5001) }] },
{ steps: [{ mode: 7, timerDurationSeconds: 0 }] },
{ steps: [{ mode: 7, timerDurationSeconds: 86401 }] },
{ steps: [{ mode: 7, timerDurationSeconds: 1, timerLabel: 'Я'.repeat(101) }] },
{ steps: [{ mode: 1 }], currentStep: 1 },
])
assert.throws(() => parsePlan(value))
})