Created
          August 22, 2011 13:39 
        
      - 
      
- 
        Save ghermeto/1162394 to your computer and use it in GitHub Desktop. 
    jasmine-node simple sample
  
        
  
    
      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
    
  
  
    
  | 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; | |
| }); | |
| }); | |
| }); | 
  
    
      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
    
  
  
    
  | 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