Created
May 15, 2015 11:19
-
-
Save sukhmeet2390/5a18455937b4c00a9ca2 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
describe("getTweets", function () { | |
var fakeData = [ | |
{ | |
created_at: "Fri Apr 05 19:39:30 +0000 2013", | |
text: "tweet 1", | |
retweeted: false, | |
favorited: false, | |
user: { name: "name 1" } | |
}, | |
/* ... */ | |
]; | |
before(function () { | |
sinon.stub($, "ajax").yieldsTo("success", fakeData); | |
}); | |
it("should $.ajax & invoke callback", function (done) { | |
twitter.getTweets("elijahmanor", function (tweets) { | |
expect(tweets.length).to.be(5); | |
done(); | |
}); | |
}); | |
after(function () { $.ajax.restore(); }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment