Files
yovision/Sense/ui/tests/unit/sense/liveviewStatus.spec.js

17 lines
865 B
JavaScript

import { playbackStatusDetail, playbackStatusLabel, playbackStatusType, routeStatus } from '@/views/sense/liveview/playbackStatus'
describe('Sense live-view playback states', () => {
it('keeps authentication, missing stream and timeout actionable', () => {
expect(playbackStatusLabel('authentication_failed')).toBe('摄像头认证失败')
expect(playbackStatusDetail('stream_not_found')).toContain('视频服务')
expect(playbackStatusDetail('timeout')).toContain('20 秒')
expect(playbackStatusType('offline')).toBe('danger')
})
it('maps route readiness without relying on color alone', () => {
expect(routeStatus('ready')).toEqual({ label: '可观看', type: 'success' })
expect(routeStatus('waiting')).toEqual({ label: '等待观看', type: 'warning' })
expect(routeStatus('apply_failed').label).toBe('需要处理')
})
})