testing webapp (via browserify) using REST.js with jasmine-ajax

29 views
Skip to first unread message

Seb

unread,
Jul 15, 2015, 4:48:01 AM7/15/15
to cuj...@googlegroups.com
Hi All,

I'm replacing jquery.ajax with REST.js, and for some reason my Jasmine test hangs

    beforeEach(function() {
      jasmine
.Ajax.install();
   
});


      it('sets ajax default url', function(done) {
       
var myClient = new MyClient(serverUrl);

        myClient
         
.client('/')
         
.then(function(response) {
            console
.log("THEN -->  " + JSON.stringify(response));
           
var request = jasmine.Ajax.requests.mostRecent();
            expect
(request.url).toContain(serverUrl);
           
done();
         
})
         
.catch(function(response) {
            console
.log("CATCH -->  " + JSON.stringify(response));
            expect
(JSON.stringify(response)).toBe(undefined);
           
done();
         
});

          console
.log("IT --> ");

     
});


It display "IT -->" and after few seconds it just times out. If I comment out "jasmine.Ajax.install();", then it would print "CATCH --> xxxx"

Any ideas ?

Thanks
Reply all
Reply to author
Forward
0 new messages