Created
July 1, 2013 14:26
-
-
Save rafaelrinaldi/5901296 to your computer and use it in GitHub Desktop.
Problem with async Jasmine tests.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
'service/auth' | |
], function( | |
auth | |
) { | |
describe('Tests "auth" service', function() { | |
var data; | |
var OPTIONS = { | |
CN: '147144147', | |
GV: '147153162' | |
}; | |
auth.on.success.addOnce(function( response ) { | |
data = response; | |
}); | |
auth.request(OPTIONS); | |
it('"status" should exist and be "true"', function() { | |
waitsFor(function() { | |
return data !== undefined; | |
}); | |
runs(function() { | |
expect(data['status']).toBeDefined(); | |
expect(data['status']).toBeTruthy(); | |
}); | |
}); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
'service/login' | |
], function( | |
login | |
) { | |
describe('Tests "login" service', function() { | |
var data; | |
var OPTIONS = { | |
oper: 1, | |
codigoouemail: '101', | |
senha: '10151015' | |
}; | |
login.on.success.addOnce(function( response ) { | |
data = response; | |
}); | |
login.request(OPTIONS); | |
it('Should get the service response for user "' + OPTIONS.codigoouemail + '"', function() { | |
waitsFor(function() { | |
return data !== undefined; | |
}); | |
runs(function() { | |
expect(data).toBeDefined(); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment