{
  "id": "fn-test-has_key",
  "dataComponent": "test",
  "heading": {
    "title": "has_key",
    "badges": [
      "Testing",
      "Assert"
    ]
  },
  "synopsis": "Asserts that a keyed array contains the specified key. If the key is missing or the subject is not keyed, it fails the test.",
  "codeBlocks": [
    "extend(\"test\")\nextend(\"array\")\n\ndescribe(\"Test has_key\", () => {\n  it(\"should confirm a keyed array has a 'foo' key\", () => {\n    obj = [ foo:\"bar\", number:100 ]\n    has_key(obj, \"foo\")  // pass\n  })\n\n  it(\"should fail if the key is missing\", () => {\n    obj = [ alpha:42 ]\n    has_key(obj, \"beta\") // fails test\n  })\n\n  it(\"should fail if the subject is not keyed array\", () => {\n    has_key([1,2,3], \"index\")  // fails test\n  })\n})"
  ],
  "notes": [
    "The first argument must be a keyed array, e.g. `[someKey:\"value\", anotherKey: 123]`.",
    "The second argument must be a single string representing the key name.",
    "If the key is absent, has_key(...) immediately fails the test, appending a 'missing key' message.",
    "If the subject is not a keyed array, it also fails the test with an appropriate error."
  ]
}
