接入前端P0页面真实接口

This commit is contained in:
andy
2026-07-08 16:20:06 +08:00
parent 5c5b8e33b0
commit 66a613d6cd
45 changed files with 8719 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
import { mount } from '@vue/test-utils'
import { describe, expect, it } from 'vitest'
import { createI18n } from 'vue-i18n'
import ReservationStatusBadge from '@/components/reservation/ReservationStatusBadge.vue'
import zhCN from '@/i18n/locales/zh-CN'
function mountWithI18n(status: string) {
const i18n = createI18n({
legacy: false,
locale: 'zh-CN',
messages: {
'zh-CN': zhCN,
},
})
return mount(ReservationStatusBadge, {
props: {
status,
},
global: {
plugins: [i18n],
},
})
}
describe('ReservationStatusBadge', () => {
it('renders stable status code through i18n label', () => {
const wrapper = mountWithI18n('PENDING_CONFIRM')
expect(wrapper.text()).toContain('待确认')
expect(wrapper.classes()).toContain('status-badge--info')
})
it('falls back to the raw code for unknown status', () => {
const wrapper = mountWithI18n('UNKNOWN_STATUS')
expect(wrapper.text()).toContain('UNKNOWN_STATUS')
})
})