Created
October 19, 2013 10:00
-
-
Save chrislaughlin/7053939 to your computer and use it in GitHub Desktop.
Jasmine Tests
This file contains hidden or 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("Main Server Tests", function() { | |
var request = require('request'); | |
it("should respond with hello world", function(done) { | |
request("http://localhost:3000/hello", function(error, response, body){ | |
expect(body).toEqual("Hello World"); | |
done(); | |
}); | |
}); | |
it("should respond 10 tweets based on a search query", function(done) { | |
request("http://localhost:3000/tweets/search?search=Belfast", function(error, response, body){ | |
var tweets = JSON.parse(body); | |
expect(tweets.length).toEqual(10); | |
expect(tweets[0].text.toLowerCase().indexOf('belfast') != -1).toBeTruthy(); | |
done(); | |
}); | |
request("http://localhost:3000/tweets/search?search=London", function(error, response, body){ | |
var tweets = JSON.parse(body); | |
expect(tweets.length).toEqual(10); | |
expect(tweets[0].text.toLowerCase().indexOf('london') != -1).toBeTruthy(); | |
done(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment