teqo-backup/tests/unit/graficosDadosSkill.unit.spec.ts

77 lines
2.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { existsSync, readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { describe, expect, it } from 'vitest'
// C191: the skill and the command are prompt text, so the product contract
// lives in the SKILL.md prose. This guard fails the build if the flow, the
// guardrails, the gitignored artifacts or the CLI contract are dropped.
const repoRoot = process.cwd()
const read = (path: string): string => readFileSync(resolve(repoRoot, path), 'utf8')
const skill = read('.agents/skills/graficos-dados/SKILL.md')
const command = read('.opencode/commands/graficos-dados.md')
describe('skill /graficos-dados documents the flow', () => {
it('declares when to use it and the canonical builder CLI', () => {
expect(skill).toContain('## Quando usar')
expect(skill).toContain('node scripts/build-chart-from-data.mjs')
expect(skill).toContain('--inspect')
expect(skill).toContain('--spec=')
})
it('pins the launch command and the gitignored artifacts', () => {
expect(skill).toContain('/graficos-dados')
expect(skill).toContain('data/graficos-instagram/')
expect(skill).toContain('docs/research/graficos-instagram/')
expect(skill).toContain('gitignored')
})
it('pins the three output sizes', () => {
expect(skill).toContain('1080×1350')
expect(skill).toContain('1080×1080')
expect(skill).toContain('1080×1920')
})
it('pins the fail-closed guardrails', () => {
expect(skill).toMatch(/partem do zero/i)
expect(skill).toMatch(/7 pontos/)
expect(skill).toMatch(/pizza/i)
expect(skill).toMatch(/pergunta, nunca completa/i)
expect(skill).toContain('--source')
expect(skill).toMatch(/fail-closed/i)
})
it('pins the official kit 1313 brand and palette (C203)', () => {
expect(skill).toContain('jorge-solla-positivo.png')
expect(skill).toContain('#e4102f')
expect(skill).toContain('#184e92')
expect(skill).not.toContain('#c51414')
})
it('pins the three-series extension and its triad (C205)', () => {
expect(skill).toMatch(/três séries/)
expect(skill).toContain('--neutral=')
expect(skill).toContain('--neutral-dark=')
expect(skill).toContain('↗ cresce')
expect(skill).toContain('↘ diminui')
expect(skill).toMatch(/só no feed/)
})
it('pins the larger brand mark of the shared footer (C206)', () => {
expect(skill).toContain('251×144')
expect(skill).toContain('192×110')
expect(skill).toContain('279×160')
})
})
describe('command /graficos-dados couples to the skill', () => {
it('references the canonical skill file and passes arguments', () => {
expect(existsSync(resolve(repoRoot, '.opencode/commands/graficos-dados.md'))).toBe(true)
expect(command).toContain('`graficos-dados`')
expect(command).toContain('$ARGUMENTS')
expect(command).toContain('.agents/skills/graficos-dados/SKILL.md')
expect(command).toContain('kit 1313')
})
})