Skip to content

Add tests for kg, nlp, web-search, and ask modules#1

Open
shixish wants to merge 1 commit into
mainfrom
test/kg-and-option-branches
Open

Add tests for kg, nlp, web-search, and ask modules#1
shixish wants to merge 1 commit into
mainfrom
test/kg-and-option-branches

Conversation

@shixish

@shixish shixish commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds test coverage for the knowledge-graph module and the previously untested option branches flagged in a coverage review. crawl.ts is intentionally left as-is.

  • tests/kg.test.tsdql (params, option forwarding, json-format omission, raw bytes, auth error), dqlParallel (empty, order preservation, per-query options), dqlRefreshOntology (writes + creates dirs, error path)
  • tests/nlp.test.ts — array unwrap, object passthrough, empty-array {}, lang default/override
  • tests/web-search.test.ts — bearer header + query, numResults/maxTokens branches, error path
  • tests/ask.test.ts — payload/header, malformed/contentless chunk skipping, non-streaming text fallback, error-status path

Also adds @vitest/coverage-v8 and a test:coverage script.

Coverage

before after
statements 75.65% 82.69%
branches 63.47% 76.43%

kg.ts, nlp.ts, web-search.ts reach 100%; ask.ts 100% stmts / 95.65% branch.

Test plan

  • pnpm test — 48 passed
  • pnpm test:coverage

🤖 Generated with Claude Code

Cover the DQL/knowledge-graph code paths (dql params, raw output, parallel
fan-out, ontology refresh) plus the previously untested option branches in
entities(), webSearch(), and the ask() streaming/error/text-fallback paths.

Raises overall coverage from ~76% to ~83% statements. Adds @vitest/coverage-v8
and a test:coverage script.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant