Skip to content

Commit

Permalink
Merge pull request #7 from codefortulsa/add-tests-3
Browse files Browse the repository at this point in the history
Adding tests #3
  • Loading branch information
groovecoder committed Jun 16, 2015
2 parents 921134b + 1e85876 commit 175ffd9
Show file tree
Hide file tree
Showing 4 changed files with 1,257 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: node_js
node_js:
- "0.12"
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "A sample Node.js app using Express 4",
"main": "index.js",
"scripts": {
"start": "node index.js"
"start": "node index.js",
"test": "./node_modules/.bin/mocha"
},
"dependencies": {
"cheerio": "^0.19.0",
Expand All @@ -13,6 +14,12 @@
"request": "^2.57.0",
"string": "^3.2.0"
},
"devDependencies": {
"chai": "^3.0.0",
"chai-as-promised": "^5.1.0",
"mocha": "^2.2.5",
"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 175ffd9

Please sign in to comment.