up
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { test } from 'node:test'
|
||||
import { Controller, parseCommand } from './controller.js'
|
||||
import { buildScreenPackage } from './screen-package.js'
|
||||
import { buildScreenPackage, parseScreenPackage } from './screen-package.js'
|
||||
import { packageKey, type LocalPackage } from './package-store.js'
|
||||
import { parseResults } from './results.js'
|
||||
import { formatTimer, remainingTime } from '../src/utils/presentation.js'
|
||||
@@ -53,7 +53,7 @@ function fixture() {
|
||||
formatVersion: 1,
|
||||
key: packageKey(pkg.server, 7),
|
||||
version: 'a'.repeat(64),
|
||||
package: pkg,
|
||||
package: parseScreenPackage(pkg),
|
||||
files: [],
|
||||
}
|
||||
c.selectPackage(local)
|
||||
@@ -79,7 +79,9 @@ test('проходит восемь шагов, подставляет лока
|
||||
assert.notEqual(f.c.state.catalog.cover, f.c.state.catalog.background)
|
||||
for (let i = 0; i < 8; i++) {
|
||||
f.send({ action: 'step', index: i })
|
||||
assert.equal(f.c.state.scene.mode, i + 1)
|
||||
assert.equal(f.c.state.scene.mode, [1, 2, 8, 4, 8, 6, 7, 8][i])
|
||||
if (i === 2) assert.equal(f.c.state.scene.text, 'Успехов')
|
||||
if (i === 4) assert.equal(f.c.state.scene.text, 'Спасибо за игру!')
|
||||
assert.equal(f.c.state.scene.stepIndex, i)
|
||||
assert.equal(f.c.state.channels.main.desired, 'stopped')
|
||||
assert.equal(f.c.state.timer.status, 'stopped')
|
||||
@@ -104,7 +106,7 @@ test('смена сцены останавливает основное меди
|
||||
})
|
||||
assert.equal(f.c.state.scene.stepIndex, 1)
|
||||
assert.equal(f.c.state.scene.mode, 2)
|
||||
f.send({ action: 'mode', mode: 3 })
|
||||
f.send({ action: 'text', text: 'Успехов' })
|
||||
assert.equal(f.c.state.channels.main.desired, 'stopped')
|
||||
assert.equal(f.c.state.channels.music.desired, 'playing')
|
||||
assert.equal(f.c.state.scene.stepIndex, null)
|
||||
@@ -209,13 +211,15 @@ test('не допускает пустой текст и некорректны
|
||||
{ action: 'timer-set', label: '', durationSeconds: 0 },
|
||||
{ action: 'timer-set', label: '', durationSeconds: 1.5 },
|
||||
{ action: 'timer-set', label: 'x'.repeat(201), durationSeconds: 10 },
|
||||
{ action: 'mode', mode: 3 },
|
||||
{ action: 'mode', mode: 5 },
|
||||
{ action: 'mode', mode: 9 },
|
||||
{ action: 'mode', mode: NaN },
|
||||
{ action: 'step', index: -1 },
|
||||
{ action: ['timer-start'] },
|
||||
])
|
||||
assert.throws(() => parseCommand({ ...base, ...intent }))
|
||||
for (const mode of [1, 2, 3, 4, 5, 6, 7, 8] as ScreenMode[])
|
||||
for (const mode of [1, 2, 4, 6, 7, 8] as ScreenMode[])
|
||||
assert.equal(parseCommand({ ...base, action: 'mode', mode }).action, 'mode')
|
||||
})
|
||||
function snapshot(key: string) {
|
||||
|
||||
Reference in New Issue
Block a user