- streamer/windows: vash-broadcast.exe (setup/login/start/stop/status/doctor) with per-instance OBS, tosu and FFmpeg, a supervised worker, OCR room selection and OBS scene reconciliation; built and tested on Linux only - streamer/relay.ts shared with Vash TV; Cloudflare Access proxy for dev/staging - worker status validation and live score helpers for the site - STREAMING_HANDOFF.md and streamer/ALPHA_TEST.md record what is unverified Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { describe, expect, test } from 'vitest';
|
|
import { parseWorkerStatus, workerTone } from './worker';
|
|
|
|
describe('parseWorkerStatus', () => {
|
|
test('keeps known states and trims what a worker sends', () => {
|
|
expect(
|
|
parseWorkerStatus(
|
|
{
|
|
state: 'spectating',
|
|
detail: ' room selected ',
|
|
onAir: true,
|
|
encoder: 'AMD AMF (hardware)',
|
|
instance: 'prod',
|
|
version: '0.1.0',
|
|
extra: 'ignored'
|
|
},
|
|
1000
|
|
)
|
|
).toEqual({
|
|
state: 'spectating',
|
|
detail: 'room selected',
|
|
onAir: true,
|
|
encoder: 'AMD AMF (hardware)',
|
|
instance: 'prod',
|
|
version: '0.1.0',
|
|
at: 1000
|
|
});
|
|
});
|
|
|
|
test('an unknown state shows as needing attention, and nothing unbounded gets through', () => {
|
|
const status = parseWorkerStatus(
|
|
{ state: 'toString', detail: 'x'.repeat(1000), onAir: 'yes' },
|
|
1
|
|
);
|
|
expect(status.state).toBe('error');
|
|
expect(status.detail).toHaveLength(300);
|
|
expect(status.onAir).toBe(false);
|
|
expect(parseWorkerStatus({ state: 'weird' }, 1).detail).toBe('Unknown state "weird"');
|
|
expect(workerTone('login-required')).toBe('bad');
|
|
expect(workerTone('spectating')).toBe('ok');
|
|
});
|
|
});
|