UNPKG

@aligntrue/testkit

Version:

Conformance testkit for Align Spec v1 implementations

214 lines (213 loc) β€’ 7.16 kB
[ { "name": "stable-key-ordering", "description": "Verifies that object keys are sorted lexicographically regardless of input order", "input": { "z": 1, "a": 2, "m": 3 }, "expected_jcs": "{\"a\":2,\"m\":3,\"z\":1}", "expected_sha256": "ebba85cfdc0a724b6cc327ecc545faeb38b9fe02eca603b430eb872f5cf75370" }, { "name": "nested-object-sorting", "description": "Verifies that nested object keys are recursively sorted", "input": { "zebra": { "foo": 1, "bar": 2 }, "apple": { "zed": 3, "ant": 4 } }, "expected_jcs": "{\"apple\":{\"ant\":4,\"zed\":3},\"zebra\":{\"bar\":2,\"foo\":1}}", "expected_sha256": "33da6bd83413ae5acb6f75ec3d7c7599ad51490a5174a751be1ff844c005cdf1" }, { "name": "array-order-preservation", "description": "Verifies that array element order is preserved during canonicalization", "input": { "items": [3, 1, 2] }, "expected_jcs": "{\"items\":[3,1,2]}", "expected_sha256": "de21aef9c6d6b65cfe6dc3c9159d9969659d1f5b854c6249d871036c57a26966" }, { "name": "floating-point-numbers", "description": "Verifies correct handling of floating point numbers including zero normalization", "input": { "value": 1.5, "zero": 0, "negative": -2.5 }, "expected_jcs": "{\"negative\":-2.5,\"value\":1.5,\"zero\":0}", "expected_sha256": "dad46c2eac12f81f160a954990cac20b0808c839d84e489d4338cb8372651dac" }, { "name": "boolean-and-null", "description": "Verifies correct serialization of boolean and null values", "input": { "flag": true, "empty": null, "disabled": false }, "expected_jcs": "{\"disabled\":false,\"empty\":null,\"flag\":true}", "expected_sha256": "34db91202a5b3b1783d84a1ea915fbc7c08fc36e66952b01bb619e6fa6ed3b6e" }, { "name": "empty-collections", "description": "Verifies handling of empty arrays and objects", "input": { "deps": [], "metadata": {} }, "expected_jcs": "{\"deps\":[],\"metadata\":{}}", "expected_sha256": "cbd418b42196b2cd78e8686a7790a331e3ac4044a424c0854a33e59d6251034d" }, { "name": "unicode-strings", "description": "Verifies correct handling of unicode characters and emojis", "input": { "message": "Hello δΈ–η•Œ 🌍" }, "expected_jcs": "{\"message\":\"Hello δΈ–η•Œ 🌍\"}", "expected_sha256": "75c7fec8e76131ffe1d02497c4c0e3480a3b358ae8da984e68f28564c8e6b00f" }, { "name": "string-escaping", "description": "Verifies correct escaping of special characters in strings", "input": { "text": "Line 1\nLine 2\tTabbed" }, "expected_jcs": "{\"text\":\"Line 1\\nLine 2\\tTabbed\"}", "expected_sha256": "6ca25ecf58928f449086c55c1a7f507215a8c48baf9d0630337a55e7cea11242" }, { "name": "mixed-types-array", "description": "Verifies handling of arrays with mixed types", "input": { "mixed": [ 42, "string", true, null, { "nested": "object" } ] }, "expected_jcs": "{\"mixed\":[42,\"string\",true,null,{\"nested\":\"object\"}]}", "expected_sha256": "0ac513429a4005c509fbf5cb28b285e59f088f0e1fbdb337b23953e627ce86c3" }, { "name": "deeply-nested-structure", "description": "Verifies handling of deeply nested objects and arrays", "input": { "level1": { "level2": { "level3": { "data": [1, 2, 3] } } } }, "expected_jcs": "{\"level1\":{\"level2\":{\"level3\":{\"data\":[1,2,3]}}}}", "expected_sha256": "ee485761ef41630c7a1de2755ef9f0e6bcd5bfdfea91ceafdd10f6c6f9a7cf65" }, { "name": "large-integer", "description": "Verifies handling of large integer values", "input": { "big": 9007199254740991 }, "expected_jcs": "{\"big\":9007199254740991}", "expected_sha256": "fbbfc58f166e612251143585fa8f37eb44a5aef5de611eed4e7d5ec7a9b5879c" }, { "name": "scientific-notation", "description": "Verifies handling of numbers in scientific notation", "input": { "small": 1.5e-10, "large": 15000000000 }, "expected_jcs": "{\"large\":15000000000,\"small\":1.5e-10}", "expected_sha256": "684819daf6df39753288fdc7770a9e82594494c178bd4c82c10d72b16cc0b115" }, { "name": "empty-string", "description": "Verifies handling of empty strings", "input": { "empty": "", "present": "value" }, "expected_jcs": "{\"empty\":\"\",\"present\":\"value\"}", "expected_sha256": "d10b29fb47e6a57488ffda159b40fb5613509b62c35c6a231e04526ff6174dc4" }, { "name": "whitespace-in-values", "description": "Verifies that whitespace within string values is preserved", "input": { "spaces": " leading and trailing " }, "expected_jcs": "{\"spaces\":\" leading and trailing \"}", "expected_sha256": "893ed3471674cad9d19347d03fea604388d42336e69c1889790c492d6299b835" }, { "name": "tags-array", "description": "Verifies handling of typical tags array from Align spec", "input": { "tags": ["testing", "paved-road", "quality"] }, "expected_jcs": "{\"tags\":[\"testing\",\"paved-road\",\"quality\"]}", "expected_sha256": "3cf5cfae5faf7fceee38388afe5f9265aa144a8b1570ae7e61bb5ff3a84571f4" }, { "name": "yaml-anchor-resolution", "description": "Verifies that YAML anchors are resolved before canonicalization", "input": { "prod": { "timeout": 30, "retries": 3, "env": "production" } }, "expected_jcs": "{\"prod\":{\"env\":\"production\",\"retries\":3,\"timeout\":30}}", "expected_sha256": "87f3a71f1d763b97e26186ecf41c9a9334cf6761e41e237068c5c0d9b7aa7571" }, { "name": "complex-align-structure", "description": "Verifies canonicalization of a complex Align align structure", "input": { "id": "aligns/base/base-testing", "version": "1.0.0", "profile": "align", "spec_version": "1", "summary": "Testing baseline", "tags": ["testing", "determinism"], "deps": [], "scope": { "applies_to": ["*"] }, "rules": [ { "id": "no-sleeps", "severity": "MUST", "check": { "type": "regex", "inputs": { "include": ["**/*.test.ts"], "pattern": "sleep|setTimeout", "allow": false }, "evidence": "Sleep found in tests" } } ] }, "expected_jcs": "{\"deps\":[],\"id\":\"aligns/base/base-testing\",\"profile\":\"align\",\"rules\":[{\"check\":{\"evidence\":\"Sleep found in tests\",\"inputs\":{\"allow\":false,\"include\":[\"**/*.test.ts\"],\"pattern\":\"sleep|setTimeout\"},\"type\":\"regex\"},\"id\":\"no-sleeps\",\"severity\":\"MUST\"}],\"scope\":{\"applies_to\":[\"*\"]},\"spec_version\":\"1\",\"summary\":\"Testing baseline\",\"tags\":[\"testing\",\"determinism\"],\"version\":\"1.0.0\"}", "expected_sha256": "8ccd3fc99d8afdc71556ab8f0bae02bfff9f5abd04e0e90e9bef9e155d3ac3d5" } ]