test: add policy-service coverage and related service tests#6123
Open
mariana-andruk-qa wants to merge 2 commits into
Open
test: add policy-service coverage and related service tests#6123mariana-andruk-qa wants to merge 2 commits into
mariana-andruk-qa wants to merge 2 commits into
Conversation
Add unit and contract tests for policy-service block validators, blocks, helpers, decorators, errors, and policy-engine utilities, plus V8/c8 coverage tooling. Also add the guardian-service build-documentation-urls helper with its tests and an api-gateway dmrv service test.
Contributor
Fix: remove 't-1'
Fix: replace the Module._load block with esmock
Fix: update all three expected values to match the actual enum 'VerifiablePresentation', 'VerifiableCredential', 'DID'
real enum is: Fix: replace 'NEW' to 0
TransformationUIAddon: requires options.expression Fix: use per-block fixtures for the validators that have mandatory fields
|
- orchestrator-validators: drop the stray PolicyValidator id arg and neutralise DatabaseServer reads instead of the non-working module mock - schema-validator(+property): mock the ESM module via esmock.strict so the validators no longer require an initialized ORM - policy-utils: align expectations with the real DocumentType enum and numeric DocumentSignature.NEW - common-only-validators-batch3: give validators with mandatory options per-block fixtures - add .mocharc.json to register the esmock loader before mocha starts
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
Adds unit and contract test coverage for
policy-service, plus a couple of related tests inguardian-serviceandapi-gateway.run-coverage.mjs,coverage-report.mjs,COVERAGE_NOTES.md) and ablock-aboutcontract test.build-documentation-urlshelper with accompanying unit tests.dmrvservice test (alias resolution) usingesmock.Test results
Run against freshly built
dist/output:The policy-service tests that were previously failing are now fixed:
schema-validator(and its property test) mock the ESM module viaesmock.strict, andorchestrator-validatorsneutralisesDatabaseServerreads on the real singleton instead of the non-working module mock. A.mocharc.jsonregisters the esmock loader before mocha starts so the mock survives mocha's re-spawn.PolicyValidatorargument mismatch: dropped the stray leading id argument sopolicy/isDryRunline up with the constructor signature.CommonBlock-delegating validators with mandatory options (TransformationUIAddon,HttpRequestUIAddon) now use per-block fixtures that supply the required fields.PolicyUtilsexpectations match the implementation:getDocumentTypereturns theDocumentTypeenum values (VerifiablePresentation/VerifiableCredential/DID) andDocumentSignature.NEWis numeric0.Notes
yarn.lockchanges were intentionally excluded (unrelated dependency churn).