Get help with testing, discuss unit testing strategies etc.


Post by nickolay »

Ah, you just have t.done() below:
    StartTest(function(t) {
      
        t.waitForMs(3000, function() {
            //////////// this test fails whether in a wait or not ////////////
            t.isString(App.global.user_guid, 'App.global.user_guid exists');
        });
       
        t.done();
    })   
"waitForMs" method is obviously asynchronous, so "t.done()" call is executed right after it, before the 3s interval completes. "done" finalizes the test and aborts any ongoing waitings. Using "done" is optional, it just marks the correct exit point from the test, you can omit it altogether or move inside of "waitForMs"

Post by mfearby »

Ah, rookie mistake. Thanks. it's working now

Post Reply