Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

where can i find a list of all built in matchers for Jasmine expect

Tags:

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.

like image 639
lobengula3rd Avatar asked Oct 10 '14 07:10

lobengula3rd


People also ask

What are matchers in Jasmine?

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.

Which of the following Jasmine matchers can be used for matching a regular expression?

It checks whether something is matched for a regular expression. You can use the toMatch matcher to test search patterns.

Which method in Jasmine is used to match the expected result is true or not?

ToBeTruthy() This Boolean matcher is used in Jasmine to check whether the result is equal to true or false.

Which of the following matcher function is used to test greater than?

The toBeGreaterThan and toBeLessThan matchers check if something is greater than or less than something else.


2 Answers

You can find it in wiki on GitHub.

like image 75
Sven Schürmann Avatar answered Feb 08 '23 09:02

Sven Schürmann


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);
like image 40
Rudi Avatar answered Feb 08 '23 10:02

Rudi