

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
123456# Rust Testing Strategy78## Verification Commands910- When modifying Rust code, run clippy to detect issues:1112```bash13 cargo clippy --all-features --all-targets --workspace --no-deps14```1516- If changes affect the `hash-graph-api` crate or any representation influencing the public interface, regenerate the OpenAPI specifications:1718```bash19 cd libs/@local/graph/api20 cargo run --bin openapi-spec-generator21```2223- Use `cargo doc --no-deps --all-features` to check documentation2425## Test Execution2627- Use `cargo-nextest` for running unit and integration tests28- Use the default test runner for documentation tests29- For comprehensive verification, run the complete test suite30- Database seeding can be performed using yarn commands in the project's package.json3132## Test Design Principles3334- Test both happy paths and error conditions for each function35- For each error case in your code, write a corresponding test36- Test boundary conditions and edge cases explicitly37- Include tests for invalid or malformed inputs38- For streaming encoders/decoders, test partial data handling and buffer management39- Aim for high test coverage but prioritize test quality over quantity40- Structure tests following the Arrange-Act-Assert pattern4142## Assertion Standards4344- Use descriptive assertion messages that explain the expected behavior45- All assertion messages (including `expect()`, `unwrap()` and `assert*()`) should follow the "should..." format:4647```rust48 // Good examples:49 value.expect("should contain a valid configuration");50 assert_eq!(result, expected, "Result should match the expected value");51```5253- Use `expect()` or `expect_err()` with clear messages instead of `unwrap()` or `unwrap_err()`54- Prefer `assert_eq!` with custom messages over bare assertions when comparing values55- When testing errors, assert on specific error types or message contents, not just that an error occurred56- Balance assertions to verify functionality without creating brittle tests5758## Test Organization5960- Group related tests into appropriate modules61- Use descriptive test names that explain the test scenario and expected outcome62- Do not prefix test function names with `test_` (avoid `test::test_name` patterns)63- Use helper functions to avoid code duplication in tests64- Consider using parameterized tests for testing similar functionality with different inputs6566## Test Code Quality6768- Follow the same code quality standards in test code as in production code69- Add appropriate assertions for array/slice access to avoid clippy warnings70- Document test scenarios with clear comments explaining:71 - The setup (input and environment)72 - The action being tested73 - The expected outcome74 - Why the outcome is expected75- Consider adding custom test utilities to simplify common testing patterns76- Use the `json!` macro from `serde_json` instead of constructing JSON as raw strings7778```rust79// Bad:80let json_str = "{\"name\":\"value\",\"nested\":{\"key\":42}}";8182// Good:83use serde_json::json;84let json_value = json!({85 "name": "value",86 "nested": {87 "key": 4288 }89});90```9192## Integration With Other Practices9394- For documentation practices in tests, refer to the [Rust Documentation Practices](mdc:.cursor/rules/documenting-rust-code.mdc) file95- For error handling in tests, refer to the [Rust Error Handling Practices](mdc:.cursor/rules/rust-error-handling.mdc) file96
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hashintel/hashlibs/@hashintel/ds-components/AGENTS.md · 1.6k | AGENTS.md | buildtestlint-formatstyle+5 | 97/100 | 14 days ago | |
| hashintel/hash.cursor/rules/ai-assistant-guidelines.mdc · 1.6k | Cursor rules | do-not | 51/100 | 14 days ago | |
| hashintel/hash.cursor/rules/git-commit-conventions.mdc · 1.6k | Cursor rules | lint-formatstylegitdo-not | 51/100 | 14 days ago | |
| hashintel/hash.cursor/rules/meaningful-identifiers.mdc · 1.6k | Cursor rules | do-not | 32/100 | 14 days ago | |
| hashintel/hash.cursor/rules/rust-coding-style.mdc · 1.6k | Cursor rules | lint-formatstyletypesdependencies+2 | 69/100 | 14 days ago | |
| hashintel/hash.cursor/rules/rust-documentation.mdc · 1.6k | Cursor rules | docs | 33/100 | 14 days ago | |
| hashintel/hash.cursor/rules/rust-error-handling.mdc · 1.6k | Cursor rules | no sections | 31/100 | 14 days ago | |
| hashintel/hash.cursor/rules/rust-tracing-practices.mdc · 1.6k | Cursor rules | no sections | 45/100 | 14 days ago | |
| hashintel/hash.cursor/rules/typescript-coding-guidelines.mdc · 1.6k | Cursor rules | styletypesdo-not | 65/100 | 14 days ago | |
| hashintel/hash.cursor/rules/update-rules.mdc · 1.6k | Cursor rules | no sections | 4/100 | 14 days ago | |
| hashintel/hash.github/instructions/code-review.instructions.md · 1.6k | Copilot instructions | lint-formatstylegitdo-not+1 | 78/100 | 14 days ago | |
| hashintel/hash.github/instructions/rust-review.instructions.md · 1.6k | Copilot instructions | lint-formatstylegitdo-not | 73/100 | 14 days ago | |
| hashintel/hash.github/instructions/typescript-review.instructions.md · 1.6k | Copilot instructions | testlint-formatstyletypes+2 | 66/100 | 14 days ago | |
| hashintel/hashAGENTS.md · 1.6k | AGENTS.md | testlint-formatarchtypes+4 | 93/100 | 14 days ago | |
| hashintel/hashlibs/@hashintel/petrinaut/AGENTS.md · 1.6k | AGENTS.md | buildtestlint-formatstyle | 80/100 | 14 days ago | |
| hashintel/hashlibs/@hashintel/ds-helpers/AGENTS.md · 1.6k | AGENTS.md | archdependenciesagent-behaviour | 62/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 46 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 14 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 14 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 46 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/hashintel-hash-cursor-rules-rust-testing-strategy)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.