feat(core): rich scenario assertions — 8 assertion types + evaluateScenario()#100
Merged
Conversation
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
Implements 8 declarative assertion types for scenario evaluation:
event_order— verify events appear in a specific orderevent_count— verify count of events (optionally filtered by action)payload_field— verify a payload field value (equals/contains)timing— verify timing gaps between two actions (minGapMs/maxGapMs)session_state— verify session status (active/completed/aborted)failure_severity— verify a specific failure has expected severityno_failures— verify no failures detectedfailure_count— verify count of detected failures (optionally by code)New API
Backward Compatibility
Scenariotype extended with optionalassertionsfieldexpectedFailureswork unchangedexpectedFailurescomparison still evaluated inevaluateScenario()Files Changed
packages/toolkit/src/core/types.ts—ScenarioAssertion,AssertionResult,ScenarioEvalResulttypes + optionalassertionsonScenariopackages/toolkit/src/core/assertions.ts— new module (evaluators +runAssertions+evaluateScenario)packages/toolkit/src/core/assertions.test.ts— 27 unit testspackages/toolkit/src/core/index.ts— export assertions APIpackages/toolkit/src/index.ts— re-export from root barrel.changeset/v03-assertions.md— minor bump changesetCURRENT_STATE.md— updated with v0.3.0 progressCloses #86
Checklist
runAssertions()evaluates each assertion against analysis resultsevaluateScenario()combines parsing + detection + assertionsevaluateScenario()with mixed assertions@ocpp-debugkit/toolkit/coreand root barrelCURRENT_STATE.mdupdated