refine Semi UI vehicle evidence

This commit is contained in:
lingniu
2026-07-18 18:07:15 +08:00
parent 801a9851ea
commit 5bfdc7f637
13 changed files with 110 additions and 47 deletions

View File

@@ -0,0 +1,16 @@
import { describe, expect, test } from 'vitest';
import { protocolDisplayLabel, protocolSourceLabel } from './protocols';
describe('protocol display vocabulary', () => {
test('uses one user-facing label for every supported vehicle protocol', () => {
expect(protocolDisplayLabel('GB32960')).toBe('GB/T 32960');
expect(protocolDisplayLabel('JT808')).toBe('JT/T 808');
expect(protocolDisplayLabel('YUTONG_MQTT')).toBe('宇通 MQTT');
});
test('keeps unknown protocols intact and explains qualified sources', () => {
expect(protocolDisplayLabel('CUSTOM')).toBe('CUSTOM');
expect(protocolSourceLabel('YUTONG_MQTT:canonical')).toBe('宇通 MQTT · canonical');
expect(protocolSourceLabel('CUSTOM:gateway')).toBe('CUSTOM:gateway');
});
});