refactor: centralize paired room role normalization (#193)
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { normalizeAgentOutputPhase, toVisiblePhase } from './types.js';
|
||||
import {
|
||||
normalizeAgentOutputPhase,
|
||||
normalizePairedRoomRole,
|
||||
normalizePairedRoomRoleOrNull,
|
||||
toVisiblePhase,
|
||||
} from './types.js';
|
||||
|
||||
describe('phase helpers', () => {
|
||||
it('maps agent output phases to visible phases', () => {
|
||||
@@ -15,3 +20,17 @@ describe('phase helpers', () => {
|
||||
expect(normalizeAgentOutputPhase('progress')).toBe('progress');
|
||||
});
|
||||
});
|
||||
|
||||
describe('paired room role helpers', () => {
|
||||
it('normalizes valid paired room roles', () => {
|
||||
expect(normalizePairedRoomRole('owner')).toBe('owner');
|
||||
expect(normalizePairedRoomRole('reviewer')).toBe('reviewer');
|
||||
expect(normalizePairedRoomRole('arbiter')).toBe('arbiter');
|
||||
});
|
||||
|
||||
it('rejects invalid paired room roles', () => {
|
||||
expect(normalizePairedRoomRole('single')).toBeUndefined();
|
||||
expect(normalizePairedRoomRole(undefined)).toBeUndefined();
|
||||
expect(normalizePairedRoomRoleOrNull('codex')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user