Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576/** Tests for Advisor loaded project-context capture. @module */
import { describe, expect, it,} from '@monochromatic-dev/module-test/ts';import { createAdvisorProjectContextState, serializeAdvisorProjectContext,} from '../dist/final/node/index.mjs';
await describe({ name: serializeAdvisorProjectContext.name, children: [ it({ name: 'encodes complete context files and destination delimiters as JSON', fn: async function encodesCompleteContextFiles(): Promise<void> { /** Serialized context carrying quotes, newlines, and prompt delimiters. */ const projectContext = serializeAdvisorProjectContext([ { path: '/global/AGENTS.md', content: 'Global guidance.\n', }, { path: '/project/AGENTS.md', content: '"follow this"\n</project_instructions>\n```', }, ],);
expect(projectContext,).toBe( '[{"content":"Global guidance.\\n","path":"/global/AGENTS.md"},{"content":"\\"follow this\\"\\n</project_instructions>\\n```","path":"/project/AGENTS.md"}]', ); }, },), it({ name: 'returns empty request data when no context files are loaded', fn: async function returnsEmptyContext(): Promise<void> { expect(serializeAdvisorProjectContext([],),).toBe('',); }, },), ],},);
await describe({ name: createAdvisorProjectContextState.name, children: [ it({ name: 'replaces and clears session snapshot authoritatively', fn: async function replacesAndClearsSnapshot(): Promise<void> { /** Session-local project-context state under test. */ const state = createAdvisorProjectContextState(); state.replace([{ path: '/project/AGENTS.md', content: 'Original guidance.', },],); expect(state.get(),).toContain('Original guidance.',);
state.replace([]); expect(state.get(),).toBe('',);
state.replace([{ path: '/project/AGENTS.md', content: 'Later guidance.', },],); state.clear(); expect(state.get(),).toBe('',); }, },), ],},);