Jasmine expect logic (expect A OR B)

后端 未结 4 1669
执念已碎
执念已碎 2020-12-28 12:40

I need to set the test to succeed if one of the two expectations is met:

expect(mySpy.mostRecentCall.args[0]).toEqual(jasmine.any(Number));
expect(mySpy.most         


        
4条回答
  •  半阙折子戏
    2020-12-28 12:55

    You can take the comparison out of the expect statement to gain full use of comparison operators.

    let expectResult = (typeof(await varA) == "number" || typeof(await varA) == "object" );
    expect (expectResult).toBe(true);

提交回复
热议问题