clawdie-ai/setup/operator-auth.test.ts
Operator & Codex 6de0ed87ab Remove legacy Mevy references (Sam & Codex)
Sweep active code, tests, identity files, public docs, CMS seed content, and stale handoffs so old assistant-name fixtures no longer leak into current Clawdie/system-namespace behavior. Keep the skills-memory SQL artifact unchanged per regeneration policy.

---

Build: pass

Tests: pass — 2197 passed (164 files)

---
Build: pass | Tests: pass — 2197 passed (650 files)
2026-05-07 11:16:40 +02:00

48 lines
1.4 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { updateOperatorAuthEnvContent } from '../src/operator-auth-reset.js';
import { parseArgs } from './operator-auth.js';
describe('operator-auth args', () => {
it('parses email and name flags', () => {
expect(
parseArgs(['--email', 'operator@example.com', '--name', 'Alpha']),
).toEqual({
email: 'operator@example.com',
name: 'Alpha',
});
});
it('ignores unrelated args', () => {
expect(parseArgs(['hello', '--email', 'operator@example.com'])).toEqual({
email: 'operator@example.com',
});
});
});
describe('operator-auth env updates', () => {
it('writes controlplane email when absent', () => {
const updated = updateOperatorAuthEnvContent(
'ASSISTANT_NAME=Clawdie\n',
'operator@example.com',
);
expect(updated).toContain(
'CONTROLPLANE_OPERATOR_EMAIL=operator@example.com',
);
expect(updated).not.toContain('OPERATOR_PASSWORD=');
});
it('replaces existing controlplane email and removes operator password', () => {
const updated = updateOperatorAuthEnvContent(
'CONTROLPLANE_OPERATOR_EMAIL=old@example.com\nOPERATOR_PASSWORD=old\n',
'operator@example.com',
);
expect(updated).toContain(
'CONTROLPLANE_OPERATOR_EMAIL=operator@example.com',
);
expect(updated).not.toContain('OPERATOR_PASSWORD=');
expect(updated).not.toContain('old@example.com');
});
});