up
This commit is contained in:
@@ -335,8 +335,10 @@ test('автопауза не запускает остановленную му
|
||||
c.selectPackage(testPackage())
|
||||
send(c, { action: 'play', channel: 'music' })
|
||||
send(c, { action: 'mode', mode: 2 })
|
||||
if (reset === 'session') { c.output(false); c.output(true) }
|
||||
else if (reset === 'game') c.selectPackage(testPackage())
|
||||
if (reset === 'session') {
|
||||
c.output(false)
|
||||
c.output(true)
|
||||
} else if (reset === 'game') c.selectPackage(testPackage())
|
||||
else ack(c, 'music', 'error')
|
||||
send(c, { action: 'mode', mode: 1 })
|
||||
assert.notEqual(c.state.channels.music.desired, 'playing')
|
||||
@@ -373,3 +375,33 @@ test('серверная синхронизация не отменяет лок
|
||||
assert.equal(c.state.channels.music.desired, 'paused')
|
||||
}
|
||||
})
|
||||
|
||||
for (const endMode of ['repeat', 'stop', 'next'] as const) {
|
||||
test(`локальная группа: ${endMode}, ручной выбор и остановка`, () => {
|
||||
const pkg = testPackage()
|
||||
pkg.package.playlists[0]!.groups = [
|
||||
{ id: 1, name: 'First', position: 0, endMode },
|
||||
{ id: 3, name: 'Empty', position: 1, endMode: 'repeat' },
|
||||
{ id: 2, name: 'Final', position: 2, endMode: 'stop' },
|
||||
]
|
||||
pkg.package.playlists[0]!.tracks[0]!.groupId = 1
|
||||
pkg.package.playlists[0]!.tracks[1]!.groupId = 2
|
||||
const c = new Controller(() => {})
|
||||
c.selectPackage(pkg)
|
||||
c.output(true)
|
||||
send(c, { action: 'group', channel: 'music', groupId: 1 })
|
||||
assert.equal(c.state.channels.music.desired, 'playing')
|
||||
assert.equal(c.state.channels.music.groupId, 1)
|
||||
assert.throws(() => send(c, { action: 'group', channel: 'music', groupId: 3 }), /пуста/)
|
||||
ack(c, 'music', 'ended', 4, 4)
|
||||
assert.equal(c.state.channels.music.groupId, endMode === 'next' ? 2 : 1)
|
||||
assert.equal(c.state.channels.music.trackIndex, endMode === 'next' ? 1 : 0)
|
||||
assert.equal(c.state.channels.music.desired, endMode === 'stop' ? 'stopped' : 'playing')
|
||||
send(c, { action: 'track', channel: 'music', trackIndex: 1 })
|
||||
assert.equal(c.state.channels.music.groupId, 2)
|
||||
send(c, { action: 'group', channel: 'music', groupId: 0 })
|
||||
assert.equal(c.state.channels.music.groupId, 0)
|
||||
assert.equal(c.state.channels.music.trackIndex, 0)
|
||||
assert.equal(c.state.channels.music.desired, 'playing')
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user