Qunit error on asynchronous call

example : test("An async test", function(){ stop(); expect(1); model.save( {} , { success : function(model,resp){ ok(model.get('id') != null, "Got id"); start(); } }); }); 

this gives me an error At least one statement was expected, but none of them were launched - call expect (0) to accept the null statements.

+4
source share
1 answer

Could this be caused by your ajax call causing an error?

If that were the case, it would never “succeed” and fail to execute the statement, and it would never call start ().

I suggest moving your statement and your start () to a “full” block instead. Ending the call ALWAYS if ajax was successful or failed.

Alternatively, you can register the statement and start () in the error block

+4
source

Source: https://habr.com/ru/post/1415503/


All Articles