fix(discover): default music chart to albums

This commit is contained in:
jxxghp
2026-08-24 22:32:45 +08:00
parent f6a5d1dfa0
commit c2b21f7e23
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -7,8 +7,8 @@ const { t } = useI18n()
// 探索模式:对齐 ListenBrainz 官方的热门统计与新发行两个入口
const mode = ref<'chart' | 'fresh'>('chart')
// 热门榜单实体:官方统计页面的热门单曲与热门专辑
const entity = ref('recording')
// 专辑榜更适合作为探索首屏,避免同一热门专辑的单曲重复占据多个卡片
const entity = ref('album')
// 热门榜单周期,取值与官方统计页面一致
const rangeName = ref('this_month')
@@ -18,14 +18,14 @@ function renderMusicView() {
}
describe('MusicView', () => {
it('defaults to the sitewide top tracks chart of the current month', async () => {
it('defaults to the sitewide top albums chart of the current month', async () => {
await renderMusicView()
const params = screen.getByTestId('music-params')
expect(params).toHaveTextContent('"media_source":"musicbrainz"')
expect(params).not.toHaveTextContent('"source"')
expect(params).toHaveTextContent('"mode":"chart"')
expect(params).toHaveTextContent('"entity":"recording"')
expect(params).toHaveTextContent('"entity":"album"')
expect(params).toHaveTextContent('"range_name":"this_month"')
expect(params).toHaveTextContent('"sort_by":"listen_count.desc"')
})
@@ -34,13 +34,13 @@ describe('MusicView', () => {
const user = userEvent.setup()
await renderMusicView()
await user.click(screen.getByText('热门专辑'))
await user.click(screen.getByText('热门单曲'))
await user.click(screen.getByText('过去一季'))
await user.click(screen.getByText('收听最少'))
await user.click(screen.getByText('仅有封面'))
const params = screen.getByTestId('music-params')
expect(params).toHaveTextContent('"entity":"album"')
expect(params).toHaveTextContent('"entity":"recording"')
expect(params).toHaveTextContent('"range_name":"quarter"')
expect(params).toHaveTextContent('"sort_by":"listen_count.asc"')
expect(params).toHaveTextContent('"with_cover":true')