This commit is contained in:
2026-10-18 05:25:23 +07:00
parent f5e645ec00
commit 30999630f0
18 changed files with 1023 additions and 185 deletions
+21 -1
View File
@@ -163,7 +163,7 @@ test('музыка независима от основного канала, mu
assert.equal(c.state.channels.main.position, 20)
assert.equal(c.state.channels.music.desired, 'playing')
assert.equal(c.state.channels.music.position, 15)
assert.equal(c.state.channels.music.volume, 35)
assert.equal(c.state.channels.music.volume, 100)
send(c, { action: 'mute', enabled: false })
assert.equal(c.state.channels.main.volume, 80)
assert.throws(
@@ -237,3 +237,23 @@ test('Range: полный файл, границы, суффикс и отказ
for (const value of ['bytes=100-', 'bytes=20-10', 'bytes=-0', 'bytes=0-1,3-5', 'bytes=-', 'abc'])
assert.equal(parseRange(value, 100), null)
})
test('обновление порядка сохраняет текущий файл и операцию, следующий трек берётся из нового порядка', () => {
const c = controller()
const pkg = testPackage()
c.selectPackage(pkg)
send(c, { action: 'play', channel: 'music' })
ack(c, 'music', 'playing', 23)
const before = structuredClone(c.state.channels.music)
pkg.package.playlists[0]!.tracks.reverse()
c.selectPackage(pkg, true)
const after = c.state.channels.music
assert.equal(after.trackIndex, 1)
assert.equal(after.source?.url, before.source?.url)
assert.equal(after.operation, before.operation)
assert.equal(after.position, 23)
assert.equal(after.desired, 'playing')
send(c, { action: 'loop', channel: 'music', enabled: true })
send(c, { action: 'next', channel: 'music' })
assert.equal(c.state.channels.music.trackIndex, 0)
})