Files
electric-cherry/tests/unit/ui-identity-status.test.ts

30 lines
1.2 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { serverIdentity } from '../../src/lib/ui/server-labels.js';
import { statusPresentation } from '../../src/lib/ui/status.js';
describe('operator-facing identities and states', () => {
it('preserves lobby numbers and distinguishes T6 variants sharing an engine map', () => {
expect(serverIdentity('t6_zombie_town_12')).toEqual({
map: 'Town Survival',
lobby: 12,
game: 'Black Ops II'
});
expect(serverIdentity('t6_zombie_farm_2')).toEqual({
map: 'Farm Survival',
lobby: 2,
game: 'Black Ops II'
});
expect(serverIdentity('custom-server')).toEqual({
map: 'custom-server',
lobby: null,
game: ''
});
});
it('keeps normal waiting neutral and distinguishes test success from promotion', () => {
expect(statusPresentation('awaiting-empty').tone).toBe('neutral');
expect(statusPresentation('failed').tone).toBe('danger');
expect(statusPresentation('tested').label).toBe('Test passed');
expect(statusPresentation('promoted').label).toBe('Promoted');
});
});