compares the passed in actual has each of the expected property names and optionally also if the specified property name is of the expected type
actual
expected
ex:
const actual = {foo: 42, bar: 'foo', baz: false};havingProps(['foo', ['bar', 'string']]).setActual(actual).compare(); // returns `true`havingProps([['foo': 'string'], 'bar', 'baz']).setActual(actual).compare(); // returns `false` because 'foo' is type `number`havingProps(['foobar']).setActual(actual).compare(); // returns `false` because no property named `foobar`await aftTest('example havingProps', async () => { await t.verify(actual, havingProps(['foo', ['bar', 'string']])); // succeeds}); Copy
const actual = {foo: 42, bar: 'foo', baz: false};havingProps(['foo', ['bar', 'string']]).setActual(actual).compare(); // returns `true`havingProps([['foo': 'string'], 'bar', 'baz']).setActual(actual).compare(); // returns `false` because 'foo' is type `number`havingProps(['foobar']).setActual(actual).compare(); // returns `false` because no property named `foobar`await aftTest('example havingProps', async () => { await t.verify(actual, havingProps(['foo', ['bar', 'string']])); // succeeds});
an array of either property name strings or arrays of property name and property type strings like [['propName', 'propType']]
[['propName', 'propType']]
a new HavingProperties instance
HavingProperties
Generated using TypeDoc
compares the passed in
actual
has each of theexpected
property names and optionally also if the specified property name is of theexpected
typeex: