mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-25 08:48:08 +02:00
Enforce flat wiki keys
This commit is contained in:
parent
45e5530a92
commit
f138ead5be
21 changed files with 323 additions and 73 deletions
|
|
@ -38,6 +38,25 @@ describe('WikiReadTool', () => {
|
|||
expect(result.markdown).toContain('A page written earlier in the same ingest worktree.');
|
||||
});
|
||||
|
||||
it('rejects slash-delimited page keys with a flat-key suggestion', async () => {
|
||||
const rootWikiService = { readPageForUser: vi.fn().mockResolvedValue(null) };
|
||||
const pagesRepository = { findPageByKey: vi.fn(), incrementUsageCount: vi.fn() };
|
||||
const tool = new WikiReadTool(rootWikiService as any, pagesRepository as any);
|
||||
|
||||
const result = await tool.call({ key: 'orbit/company-overview' }, baseContext);
|
||||
|
||||
expect(result.structured).toEqual({
|
||||
blockKey: 'orbit/company-overview',
|
||||
content: '',
|
||||
scope: '',
|
||||
found: false,
|
||||
});
|
||||
expect(result.markdown).toContain(
|
||||
'Invalid wiki key "orbit/company-overview". Wiki keys must be flat; use "orbit-company-overview".',
|
||||
);
|
||||
expect(rootWikiService.readPageForUser).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not append derived refs to the editable markdown body', async () => {
|
||||
const rootWikiService = {
|
||||
readPageForUser: vi.fn().mockResolvedValue({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue