agentleFS
marianfoomarianfoo/mcp-sap-docs/.cursor/rules/30-tests-and-output.mdc

mcp-sap-docs / rules

Cursor rule243 starsChanged 6 months agoApache-2.0View on GitHub

When changing output formatting or test stability. @file test/tools/run-tests.js @file test/utils/parseResults.js @file test/utils/httpClient.js @file test/tools/search.smoke.js @file test/tools/sapdocssearch/search-cap-docs.js @file test/tools/sapdocssearch/search-cloud-sdk-js.js @file test/tools/sapdocssearch/search-sapui5-docs.js @file docs/TESTS.md @file docs/DEV.md

We split this 30-tests-and-output.mdc into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When changing output formatting or test stability.

    line 3
  2. Distinctive:

    Search Tests: Verify query results and context detection

    line 19
  3. Distinctive:

    Retrieval Tests: Document fetching and formatting

    line 20

≈ “Common” is an estimate: at least 1 in 5 of the 6,350 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
30-tests-and-output.mdc
# Tests & Expected Output (Rule)

When changing output formatting or test stability.

## Test Architecture
- **Test Runner**: `test/tools/run-tests.js` - Unified test execution
- **HTTP Client**: `test/_utils/httpClient.js` - Server interaction utilities
- **Result Parser**: `test/_utils/parseResults.js` - Output format validation
- **Smoke Tests**: `test/tools/search.smoke.js` - Quick functionality validation

## Expected Output Format (BM25-Only)
```
⭐️ **<document-id>** (Score: <final-score>)
   <description-preview>
   Use in sap_docs_get
```

## Test Categories
- **Search Tests**: Verify query results and context detection
- **Retrieval Tests**: Document fetching and formatting
- **Integration Tests**: End-to-end MCP tool functionality
- **Performance Tests**: Response time and resource usage

## Test Data Structure
```javascript
{
  name: 'Test Name',
  tool: 'sap_docs_search',
  query: 'search term',
  expectIncludes: ['/expected/document/id'],
  validate: (results) => { /* custom validation */ }
}
```

## Output Validation
- **Score Format**: Numeric scores with 2 decimal places
- **Context Indicators**: Emoji-based context detection (🎨🏗️🧪)
- **Source Attribution**: Clear library identification
- **Result Limits**: Configurable via `CONFIG.RETURN_K` (default: 25)

## Test Execution
- **Fast Tests**: `npm run test:fast` - Skip build, use existing artifacts
- **Full Tests**: `npm run test` - Build + test complete pipeline  
- **Smoke Tests**: `npm run test:smoke` - Quick validation only
- **Community Tests**: `npm run test:community` - SAP Community search functionality
- **MCP Inspector**: `npm run inspect` - Debug MCP protocol interactions

@file test/tools/run-tests.js
@file test/_utils/parseResults.js
@file test/_utils/httpClient.js
@file test/tools/search.smoke.js
@file test/tools/sap_docs_search/search-cap-docs.js
@file test/tools/sap_docs_search/search-cloud-sdk-js.js
@file test/tools/sap_docs_search/search-sapui5-docs.js
@file docs/TESTS.md
@file docs/DEV.md

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.