up
This commit is contained in:
@@ -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))
|
||||
})
|
||||
Reference in New Issue
Block a user