Skip to content

Instantly share code, notes, and snippets.

@ghermeto
Created August 22, 2011 13:39
Show Gist options
  • Save ghermeto/1162394 to your computer and use it in GitHub Desktop.
Save ghermeto/1162394 to your computer and use it in GitHub Desktop.
jasmine-node simple sample
var Blitz = require('../lib/blitz.js');
describe("Blitz", function () {
it("should return a Rush Result object", function () {
var finished = false;
runs (function() {
Blitz('user', 'key', 'localhost', 9295)
.rush({
user: 'c123',
pattern: { intervals: []},
url: 'http://127.0.0.1'
}, function (err, data) {
expect(data.region).toBeDefined();
expect(data.timeline).toBeDefined();
finished = true;
});
});
waitsFor(function () {
return finished;
});
});
it("should return a Sprint Result object", function () {
var finished = false;
runs (function() {
Blitz('user', 'key', 'localhost', 9295)
.sprint({url: 'http://127.0.0.1'}, function (err, data) {
expect(data.region).toBeDefined();
expect(data.duration).toBeDefined();
expect(data.connect).toBeDefined();
expect(data.request).toBeDefined();
expect(data.response).toBeDefined();
finished = true;
});
});
waitsFor(function () {
return finished;
});
});
});
var Validate = require('../../lib/validate');
describe("Validate", function () {
it("should pass validation", function () {
var json = { url: 'http://172.0.0.1'},
hash = Validate(json);
expect(hash.valid()).toBeTruthy();
expect(hash.result()).toBeNull();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment