-
Notifications
You must be signed in to change notification settings - Fork 3
test: add comprehensive TF-IDF index tests #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
commit: |
Expand TF-IDF test coverage from 3 to 16 tests, organized into logical test suites: 1. Core Functionality (3 tests - existing): - TF-IDF ranking with cosine similarity - Stopword and punctuation removal - No matches for non-overlapping queries 2. Score Validation (2 tests - new): - Scores within [0, 1] range - Results sorted by score descending 3. Edge Cases (4 tests - new): - Empty query handling - Empty corpus handling - Single document corpus - Query with only stopwords 4. Case Sensitivity (1 test - new): - Case-insensitive search across different cases 5. Tool Name Scenarios (3 tests - new): - Tool names with underscores - Multiple query terms - Action type ranking (create, list, etc) 6. Search Limits (2 tests - new): - Respects k parameter - Handles k > corpus size 7. IDF Calculation (1 test - new): - Rare terms get higher IDF scores These tests ensure the TF-IDF implementation is robust and handles real-world scenarios, especially tool discovery use cases. Matches test coverage added to Python SDK for feature parity.
ec954d5 to
2cbe5ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR significantly expands the test coverage for the TF-IDF index implementation by reorganizing existing tests into logical groups and adding comprehensive test cases for edge cases, score validation, case sensitivity, tool name scenarios, search limits, and IDF calculation behavior.
- Reorganized tests into structured
describeblocks for better organization - Added extensive test coverage for edge cases (empty queries/corpus, single document, stopword-only queries)
- Added tests for score validation, sorting, and range checking
- Added tests for case-insensitive search behavior
- Added practical tool name scenarios testing (relevant for the SDK's use case)
- Refactored CLAUDE.md to reference skill-based documentation
- Removed Orama docs MCP server configuration
- Added comprehensive skill documentation for testing, TypeScript patterns, file operations, and architecture
Reviewed Changes
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/tfidf-index.spec.ts | Expanded test suite with 11 new test cases organized into 7 describe blocks covering edge cases, score validation, case sensitivity, tool name scenarios, search limits, and IDF calculation |
| CLAUDE.md | Refactored to delegate to skill-based documentation files for better organization and maintainability |
| .mcp.json | Removed Orama docs MCP server configuration |
| .claude/skills/typescript-testing/SKILL.md | Added comprehensive testing skill documentation covering Bun test runner, MSW patterns, and file system testing |
| .claude/skills/typescript-patterns/SKILL.md | Added TypeScript best practices skill covering exhaustiveness checking, avoiding any, and other patterns |
| .claude/skills/orama-integration/SKILL.md | Added Orama integration reference skill pointing to official documentation |
| .claude/skills/openapi-architecture/SKILL.md | Added architecture skill documenting core components and design patterns |
| .claude/skills/file-operations/SKILL.md | Added file operations skill documenting utility functions and HTTP standards |
| .claude/skills/development-workflow/SKILL.md | Added development workflow skill covering build commands, testing, and code quality |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
willleeney
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
enrich tf-idf test