Hello World
要使用 Jasmine 创建最基本的测试,请转到 spec
(tests)文件夹并添加名为 testSpec.js
的文件。
在该文件中添加以下内容:
var request = require("request");
describe("Hello World Test", function() {
// This is your test bundle
describe("GET SO", function() {
//This is testing that http GET works
it("Checks if SO is online", function() {
// This is description of your test - this is what you get when it fails
request.get("http://stackoverflow.com/", function(error, response, body) {
// this is your test body
expect(response.statusCode).toBe(200);
// this is your test assertion - it expects status code to be '200'
});
});
});
});