reynish
8/20/2013 - 7:48 PM

nodejs-mocha-chai-superagent-example.js

var request = require('superagent')
  , chai = require('chai')
  , expect = chai.expect;

describe("passing browser", function() {  
    
    var response;
    
    before(function(done) {
        request
            .get('http://www.google.co.uk/')
            .end(function(res){
                response = res;
                done();
            });
    });

    it("response is 200", function() {
        expect(response.status).to.equal(200);
    });

    it("response type", function() {
        expect(response.type).to.equal("text/html");
    });
    
});