test(insurance): expand unit coverage for surcharge merge/generator guards (W-23217457)#174
Open
offlineforce wants to merge 1 commit into
Open
test(insurance): expand unit coverage for surcharge merge/generator guards (W-23217457)#174offlineforce wants to merge 1 commit into
offlineforce wants to merge 1 commit into
Conversation
…@W-23217457@) Add direct unit tests for two exported collectors that previously had zero direct coverage, plus uncovered branches of the safe-literal guards that back the #168 surcharge-merge hardening (now on main): - collectEmittedAttributes: sanitized output, exclusion of conditions dropped by unknown operators / the safe-literal guard, contextTagName fallback. - collectAttributeTypes: dataType->CML-type mapping, unknown/missing fallback to string, conflict downgrade to string, raw-name keying. - buildConstraintDeclaration: leading-plus numeric rejection, clean ISO datetime acceptance, format-only date limitation, multi-value In heterogeneous-safety drop + clean-expansion regression guard. Test-only change; no source files touched.
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
Test-only follow-up to PR #168 (surcharge-merge hardening, now on
main). Adds automated unit coverage for guard branches and exported collectors that previously had no direct tests. No source files are touched.What's added (
test/shared/insurance/insurance-rule-generator.test.ts)collectEmittedAttributes(new block): returns sanitized attribute names; excludes attributes of conditions dropped by unknown operators or by the safe-literal guard; falls back to sanitizedcontextTagName.collectAttributeTypes(new block): dataType→CML-type mapping (Number→int, Percent/Currency→decimal, Boolean→boolean, Date→date, String→string); unknown/missing→string; conflicting dataTypes downgrade to string; keys by raw attribute name.buildConstraintDeclaration(added cases): leading-plus numeric literal rejected (+123→true); clean ISO datetime accepted through Date Equals; format-only date limitation pinned (2020-13-45passes shape check); multi-valueIndrops when any value is unsafe, and a clean multi-valueInexpands correctly.Test plan
yarn mocha test/shared/insurance/insurance-rule-generator.test.ts— passing locally (86 tests).@W-23217457@