Skip to content

Instantly share code, notes, and snippets.

@sukhmeet2390
Created May 15, 2015 11:19
Show Gist options
  • Save sukhmeet2390/5a18455937b4c00a9ca2 to your computer and use it in GitHub Desktop.
Save sukhmeet2390/5a18455937b4c00a9ca2 to your computer and use it in GitHub Desktop.
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