18 lines
808 B
TypeScript
18 lines
808 B
TypeScript
import assert from 'node:assert/strict'
|
|
import { test } from 'node:test'
|
|
import { playbackControl } from '../src/utils/playbackControl.js'
|
|
import type { ChannelState } from '../src/types/screen.js'
|
|
|
|
for (const [desired, status, action, label] of [
|
|
['stopped', 'stopped', 'play', 'Запуск'],
|
|
['playing', 'playing', 'pause', 'Пауза'],
|
|
['playing', 'pending', 'pause', 'Пауза'],
|
|
['paused', 'paused', 'resume', 'Продолжить'],
|
|
['playing', 'error', 'play', 'Запуск'],
|
|
['playing', 'ended', 'play', 'Запуск'],
|
|
] satisfies [ChannelState['desired'], ChannelState['status'], string, string][]) {
|
|
test(`кнопка проигрывателя ${desired}/${status}: ${action}`, () => {
|
|
assert.deepEqual(playbackControl({ desired, status }), { action, label })
|
|
})
|
|
}
|