Skip to content

Commit

Permalink
for #3 - chai-as-promised test for gauge
Browse files Browse the repository at this point in the history
  • Loading branch information
groovecoder committed Jun 14, 2015
1 parent 921134b commit 6784cbf
Show file tree
Hide file tree
Showing 3 changed files with 1,251 additions and 0 deletions.
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
"request": "^2.57.0",
"string": "^3.2.0"
},
"devDependencies": {
"chai": "^3.0.0",
"chai-as-promised": "^5.1.0",
"nock": "^2.5.0"
},
"engines": {
"node": "0.12.2"
},
Expand Down
21 changes: 21 additions & 0 deletions test/gaugeSpec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var chai = require("chai");
var chaiAsPromised = require("chai-as-promised");
var nock = require("nock");

var should = chai.should();
chai.use(chaiAsPromised);

var gauge = require("../lib/gauge.js");


describe("Gauge", function() {
describe("gauge()", function() {
it("should return gauge level", function() {
var gaugePage = nock('http://waterdata.usgs.gov')
.get('/usa/nwis/uv?07164500')
.replyWithFile(200, __dirname + '/replies/gauge3.html');

return gauge().should.eventually.equal(8.9);
});
});
});
Loading

0 comments on commit 6784cbf

Please sign in to comment.