Add unit tests for ontology, protocol envelope schema, and check script - #3
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Add unit tests for ontology, protocol envelope schema, and check script#3devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- Add 36 unit tests covering all three testable modules (0% -> full coverage) - test/check.test.mjs: validates file-existence checker script - test/envelope.test.mjs: validates JSON schema structure and envelope validation via Ajv - test/ontology.test.mjs: validates YAML ontology structure, adoption, properties, boundaries - Add yaml and ajv as devDependencies - Add npm test script using node:test built-in runner - Update CI workflow to install deps and run tests Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The repository had zero test coverage across all modules. This PR adds 36 unit tests covering every testable module using Node's built-in
node:testrunner.Modules tested (all previously at 0% coverage):
scripts/check.mjs(5 tests) — validates the file-existence checker: verifies it references all required files, exits 0 on a valid repo, reports no missing files, confirms each required file is readable, and checks ESM syntax usage.protocol/envelope.schema.json(16 tests) — structural checks (valid JSON, correct$schema,title,requiredfields,additionalProperties: true, protocol pattern) + AJV-based validation: accepts valid envelopes, envelopes with optionalgate, envelopes with extra properties; rejects envelopes missingprotocol,payload,kind, orcreated_at; rejects malformedprotocolpatterns; rejects empty objects.ontology/graphite.yaml(15 tests) — validates YAML parseability, top-level fields (name,status,definition),adoptionconstraints (foundation_wide: false,requires_version: ">=1.0.0", signed decision, external dev support), all 5propertiesentries (meaning, status, candidate state), andnon_adoption_boundaryarray contents.Infrastructure changes:
devDependencies:yaml@^2.9.0,ajv@^8.20.0package.json: added"test": "node --test test/*.test.mjs"npm ci+npm teststeps.gitignorewithnode_modules/Link to Devin session: https://app.devin.ai/sessions/db0476eaba114903a707d21957c9f772
Requested by: @cemphlvn