Jasmine Expect OR

1,339 views
Skip to first unread message

SF Tester

unread,
Jun 26, 2014, 3:05:39 PM6/26/14
to jasmi...@googlegroups.com
Is there anyway to put a or clause in expects?

expect(test.toEqual(yes).or.toEqual(no))

?

Michael Bielski

unread,
Jun 26, 2014, 4:05:19 PM6/26/14
to jasmi...@googlegroups.com
I really doubt it. Those are two separate results that you should test for individually. Doing what you ask doesn't follow OAPT very well.

SF Tester

unread,
Jun 26, 2014, 5:32:24 PM6/26/14
to jasmi...@googlegroups.com
I am testing if the "last" button goes to 1 of either of 2 page. Either page is a success

Joshua Clanton

unread,
Jun 27, 2014, 10:20:52 AM6/27/14
to jasmi...@googlegroups.com
I'd suggest using a pattern like this:

var result = myFunction();
var reachedSuccessfulPage = (result === "page1" || result === "page2");

expect(reachedSuccessfulPage).toBe(true);
Reply all
Reply to author
Forward
0 new messages