- Since:
-
- 2.0.0
- See:
Example
function numberDivisibleBy(divisor) { return { asymmetricMatch: function(n) { return typeof n === 'number' && n % divisor === 0; }, jasmineToString: function() { return `<a number divisible by ${divisor}>`; } }; } var actual = { n: 2, otherFields: "don't care" }; expect(actual).toEqual(jasmine.objectContaining({n: numberDivisibleBy(2)}));
Methods
asymmetricMatch(value, matchersUtil) → {Boolean}
Determines whether a value matches this tester
Parameters:
Name | Type | Description |
---|---|---|
value |
any | The value to test |
matchersUtil |
MatchersUtil | utilities for testing equality, etc |
Returns:
- Type
- Boolean
jasmineToString(pp) → {String}
Returns a string representation of this tester to use in matcher failure messages
Parameters:
Name | Type | Description |
---|---|---|
pp |
function | Function that takes a value and returns a pretty-printed representation |
Returns:
- Type
- String