refactor: centralize paired room role normalization (#193)

This commit is contained in:
Eyejoker
2026-05-30 00:03:15 +09:00
committed by GitHub
parent 5fa5b2f684
commit adf9c16b9a
10 changed files with 107 additions and 50 deletions

View File

@@ -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();
});
});