Added a stringContaining asymmetric equality tester

* Fixes #1923.
This commit is contained in:
Steve Gravrock
2021-09-22 11:19:59 -07:00
parent 00f6708e1f
commit e3c9a59c6c
6 changed files with 110 additions and 0 deletions

View File

@@ -319,6 +319,17 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
return new j$.StringMatching(expected);
};
/**
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
* that will succeed if the actual value is a `String` that contains the specified `String`.
* @name jasmine.stringContaining
* @function
* @param {String} expected
*/
j$.stringContaining = function(expected) {
return new j$.StringContaining(expected);
};
/**
* Get a matcher, usable in any {@link matchers|matcher} that uses Jasmine's equality (e.g. {@link matchers#toEqual|toEqual}, {@link matchers#toContain|toContain}, or {@link matchers#toHaveBeenCalledWith|toHaveBeenCalledWith}),
* that will succeed if the actual value is an `Array` that contains at least the elements in the sample.