Reputation: 111
I'm a beginner web developer who is making my first personal Jasmine suite for testing one of my school projects. I ran into an issue when creating specs for a JS function I wrote that generates a random number between 1 and 20. An error occurred when I tried to chain multiple matchers together like this
it("Should return an integer value between 1 and 20.", function(){
var rollResult=rollD20();
expect(rollResult).toBeGreaterThanOrEqual(1).toBeLessThanOrEqual(20);
});
Am I missing something simple? Is there a way to apply multiple matchers in one statement or is the proper approach to split it up into multiple lines like this:
it("Should return an integer value between 1 and 20.", function(){
var rollResult=rollD20();
//CHECK WITH SEAN. CAN YOU CHAIN?
expect(rollResult).toBeGreaterThanOrEqual(1);
expect(rollResult).toBeLessThanOrEqual(20);
});
I appreciate any help! I was struggled finding a clear answer in the documentation.
Upvotes: 0
Views: 342