I am trying to find a list of all existing Jasmine expect matchers like 'toContain' etc...
Where can I find this? i have searched for a while but couldn't find something like an api.
Jasmine site doesn't have any sort of an ordered list too.
Jasmine is a testing framework, hence it always aims to compare the result of the JavaScript file or function with the expected result. Matcher works similarly in Jasmine framework. Matchers are the JavaScript function that does a Boolean comparison between an actual output and an expected output.
It checks whether something is matched for a regular expression. You can use the toMatch matcher to test search patterns.
ToBeTruthy() This Boolean matcher is used in Jasmine to check whether the result is equal to true or false.
The toBeGreaterThan and toBeLessThan matchers check if something is greater than or less than something else.
You can find it in wiki on GitHub.
I managed to find this handy document on a related project :) https://github.com/JamieMason/Jasmine-Matchers
In there they name the default ones:
expect(fn).toThrow(e);
expect(instance).toBe(instance);
expect(mixed).toBeDefined();
expect(mixed).toBeFalsy();
expect(number).toBeGreaterThan(number);
expect(number).toBeLessThan(number);
expect(mixed).toBeNull();
expect(mixed).toBeTruthy();
expect(mixed).toBeUndefined();
expect(array).toContain(member);
expect(string).toContain(substring);
expect(mixed).toEqual(mixed);
expect(mixed).toMatch(pattern);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With