适配讲解详情聚合接口

This commit is contained in:
lyf
2026-07-22 19:40:17 +08:00
parent dd29ead041
commit 4d8cc55a5c
10 changed files with 440 additions and 152 deletions

View File

@@ -35,7 +35,36 @@ describe('全局讲解播放器语言切换', () => {
vi.unstubAllGlobals()
})
it('切换到粤语时立即中断旧音频,并使用 yue-HK 播放地址', async () => {
it('详情页提供语言变体播放地址时直接切换,不请求 play-info', async () => {
await player.play({
id: 'mandarin-audio',
name: '测试讲解',
audioUrl: '/museum-assets/audio/mandarin.mp3',
language: 'zh-CN'
}, {
source: {
targetType: 'STOP',
targetId: '1823450596800289',
lang: 'zh-CN'
}
})
await expect(player.switchLanguage('yue-HK', {
id: 'cantonese-audio',
name: '测试讲解',
audioUrl: '/museum-assets/audio/cantonese.mp3',
language: 'yue-HK'
})).resolves.toBe(true)
expect(repositoryMocks.getPlayInfo).not.toHaveBeenCalled()
expect(player.currentSource.value?.lang).toBe('yue-HK')
expect(player.currentAudio.value).toEqual(expect.objectContaining({
language: 'yue-HK',
audioUrl: '/museum-assets/audio/cantonese.mp3'
}))
})
it('未提供详情语言变体时保留 play-info 刷新回退', async () => {
repositoryMocks.getPlayInfo.mockResolvedValue({
playable: true,
targetType: 'STOP',