Skip to content

test: add callAnthropic tests with record/replay fixtures#40

Merged
nujovich merged 3 commits into
nujovich:mainfrom
seba3c:llm_tests
May 26, 2026
Merged

test: add callAnthropic tests with record/replay fixtures#40
nujovich merged 3 commits into
nujovich:mainfrom
seba3c:llm_tests

Conversation

@seba3c
Copy link
Copy Markdown
Contributor

@seba3c seba3c commented May 26, 2026

Summary

Add comprehensive tests for callAnthropic in lib/prompts.mjs with a record/replay fixture system for real API responses.

What's changed

  • Removed /* v8 ignore start/end */ comments around callAnthropic so coverage tracks it
  • Added lib/__tests__/call-anthropic.test.mjs with 13 tests:
    • Successful 200 response (using buildAuditPrompt with simple CSS)
    • Missing apiKey guard
    • All 10 documented Anthropic HTTP error codes (400–529)
    • Generic error fallback when response message is missing
  • Added lib/__tests__/helpers/anthropic-recorder.mjs — lightweight fixture recorder
  • Added lib/__fixtures__/anthropic/ directory for stored responses
  • Added test:record npm script (RECORD_FIXTURES=1 vitest run)

Verification

  • All 78 tests pass
  • prompts.mjs coverage: 100% statements, 88.57% branches

@seba3c
Copy link
Copy Markdown
Contributor Author

seba3c commented May 26, 2026

@nujovich I am not able to assign the PR to you as a reviewer, can u check this option?

@nujovich nujovich self-requested a review May 26, 2026 11:12
Comment thread .gitignore Outdated
@seba3c seba3c requested a review from nujovich May 26, 2026 14:51
@nujovich nujovich merged commit f229747 into nujovich:main May 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants