Files
supabase/apps/docs/internals/markdown-schema/AgentSetup.test.ts
Katerina SkroumpelouandJoshen Lim 985ac1a8a1 test(docs): drop the removed all agent from the AgentSetup test (#50802)
Removes the `all` case from the `it.each` list in
`apps/docs/internals/markdown-schema/AgentSetup.test.ts`. #50784 deleted
the Generalist monitoring agent from `monitoring-agents.data.ts` but
left this test asking for it, so `preserves the complete all prompt in
one code block` fails with `Unknown monitoring agent id: all`. Docs
Tests runs against the PR merged with `master`, so every docs PR since
that merge has been red on this one test (example:
https://github.com/supabase/supabase/actions/runs/35868308412/job/107227347408).
No other reference to the removed agent remains under
`apps/docs/internals`, `apps/docs/data`, or the AgentSetup component.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Tests**
  * Updated the agent IDs covered by a markdown schema test.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2026-09-24 14:03:09 +03:00

50 lines
2.0 KiB
TypeScript

import { getMonitoringAgent, getMonitoringAgentPrompt } from '~/data/monitoring-agents.utils'
import { fromMarkdown } from 'mdast-util-from-markdown'
import { describe, expect, it } from 'vitest'
import { AgentSetup } from './AgentSetup'
describe('AgentSetup markdown schema', () => {
it.each(['health', 'security', 'performance', 'usage'])(
'preserves the complete %s prompt in one code block',
(id) => {
const markdown = AgentSetup({ props: { id } })
const codeBlocks = fromMarkdown(markdown).children.filter((node) => node.type === 'code')
expect(codeBlocks).toHaveLength(1)
expect(codeBlocks[0]).toMatchObject({
lang: 'text',
value: getMonitoringAgentPrompt(getMonitoringAgent(id)),
})
}
)
it('serializes the prompt and harness setup for a registered agent', () => {
const markdown = AgentSetup({ props: { id: 'health' } })
expect(markdown).toContain('**Prompt**')
expect(markdown).toContain('You are "Health monitor"')
expect(markdown).toContain('```text')
expect(markdown).toContain('**Claude**')
expect(markdown).toContain('**Codex**')
expect(markdown).toContain('**Cursor**')
expect(markdown).toContain('claude.ai/code/routines')
expect(markdown).toContain('`0 * * * *`')
expect(markdown).toContain('[Claude docs](https://code.claude.com/docs/en/routines)')
expect(markdown).toContain('[Codex docs](https://developers.openai.com/codex/app/automations)')
expect(markdown).toContain('[Cursor docs](https://cursor.com/docs/cloud-agent/automations)')
})
it('points hourly agents at Claude cloud routines', () => {
const markdown = AgentSetup({ props: { id: 'performance' } })
expect(markdown).toContain('claude.ai/code/routines')
expect(markdown).not.toContain('Desktop scheduled task')
})
it('fails clearly for an unknown agent', () => {
expect(() => AgentSetup({ props: { id: 'missing' } })).toThrow(
'Unknown monitoring agent id: missing'
)
})
})