{
"id": "fn-test-prop_equals",
"dataComponent": "test",
"heading": {
"title": "prop_equals",
"badges": [
"Testing",
"Assert"
]
},
"synopsis": "Asserts that the specified key in a keyed array has the expected value. If missing or different, it fails the test immediately.",
"codeBlocks": [
"extend(\"test\")\nextend(\"array\")\n\ndescribe(\"Test prop_equals\", () => {\n it(\"should confirm the 'city' key is 'London'\", () => {\n obj = [ name:\"Alice\", city:\"London\" ]\n prop_equals(obj, \"city\", \"London\") // pass\n })\n\n it(\"fails if the actual key's value doesn't match expected\", () => {\n obj = [ city:\"Paris\" ]\n prop_equals(obj, \"city\", \"London\") // fails test\n })\n\n it(\"fails if the key doesn't exist or the subject isn't keyed\", () => {\n prop_equals([ a:1 ], \"b\", 99) // missing key => fail\n prop_equals([10,20,30], \"0\", 10) // not keyed => fail\n })\n})"
],
"notes": [
"The first argument must be a keyed array, e.g. `[ city:\"London\" ]`.",
"The second argument is a single string (key name). If that key is missing, the test fails.",
"The third argument is the expected value. If the actual value differs, the test fails with a 'mismatch' message.",
"Use prop_equals(...) for quick checks of a keyed array's property."
]
}