Skip to content

The agent that grows with you

test(desktop): cover skills-only completions for a mid-message slash

Brooklyn Nicholson3ae9b1692825
diff --git a/apps/desktop/src/app/chat/composer/hooks/use-slash-completions.test.tsx b/apps/desktop/src/app/chat/composer/hooks/use-slash-completions.test.tsx
index 865a1239f5d..eebed60ce4d 100644
--- a/apps/desktop/src/app/chat/composer/hooks/use-slash-completions.test.tsx
+++ b/apps/desktop/src/app/chat/composer/hooks/use-slash-completions.test.tsx
@@ -6,6 +6,8 @@ import type { HermesGateway } from '@/hermes'
import { queryClient } from '@/lib/query-client'
import { invalidateSlashCompletions } from '@/lib/slash-completion-cache'
+import { isSkillItem } from '../composer-utils'
+
import { useSlashCompletions } from './use-slash-completions'
const CATALOG = {
@@ -79,4 +81,18 @@ describe('useSlashCompletions', () => {
expect((work?.metadata as { group?: string })?.group).toBe('Skills')
})
+
+ // A `/` typed mid-message is a reference dropped into prose, so the trigger
+ // filters the list to skills (use-composer-trigger). A bare mid-message `/`
+ // resolves to the same empty query as an opening `/`, so that filter runs
+ // over the catalog — which listed no skill-group rows at all, leaving the
+ // inline popover empty. Asserted through isSkillItem, the real predicate.
+ it('leaves only skills for a mid-message slash', async () => {
+ const request = vi.fn().mockResolvedValue(CATALOG)
+ const api = harness({ request } as unknown as HermesGateway)
+
+ const inline = (await completions(api, '')).filter(isSkillItem)
+
+ expect(inline.map(item => (item.metadata as { command?: string })?.command)).toEqual(['/work'])
+ })
})