Files
lingniu-vehicle-ingest/vehicle-data-platform/apps/web/src/v2/domain/protocols.test.ts
2026-07-18 18:07:15 +08:00

17 lines
767 B
TypeScript

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');
});
});