Skip to content

Expectation::toHaveKeyValue ​

Member of Expectation

idl
Expectation.toHaveKeyValue, key, value, $
  /_expect_failure

Verifies that the expectation value (a hash, orderedhash, or dictionary) has a key whose value equals another value. See idl toContainEqual for how values are compared.

Examples ​

idl
(it.expects(hash('name', 'luna'))).toHaveKeyValue, 'name', 'luna'
(it.expects(hash('name', 'luna')))._not_.toHaveKeyValue, 'name', 'sol'

Arguments ​

key ​

requiredinputtype=String | Number

Specify the key to look for.

value ​

requiredinputtype=any

Specify the value expected for the key.

Keywords ​

_expect_failure {#kw-_expect_failure} ​

optionalinputtype=Boolean

If the test fails for some reason, set this to force passing because we expected failure. This keyword is for internal use only.

Licensed under MIT.