Created
January 12, 2016 17:25
-
-
Save nerevar/f96131f86f05cf4f5931 to your computer and use it in GitHub Desktop.
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
it.only('должен вызывать _onSuccess при заданных параметрах', function(done) { | |
// TODO: 2. sinon ajax request | |
block = BEM.create('i-request_type_bem', { url: '/qwer' }); | |
sinon.stub(block, '_getArgs').returns({}); | |
sinon.stub(block, '_onSuccess', function(a, b, c, d) { | |
console.log('success', a,b,c,d); | |
done(); | |
}); | |
sinon.stub(block, '_onError', function(a, b, c, d) { | |
console.log('error', a,b,c,d); | |
done(); | |
}); | |
var server = sinon.fakeServer.create(); | |
server.respondWith("GET", "/qwer", | |
[200, { "Content-Type": "application/json" }, | |
'[{ "id": 12, "comment": "Hey there" }]']); | |
block.get(); | |
server.respond(); | |
server.restore(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment