Skip to content

Commit

Permalink
re #16 add coverage tests
Browse files Browse the repository at this point in the history
  • Loading branch information
A committed Oct 5, 2015
1 parent d8166a9 commit 92e5877
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
._*
node_modules
npm-debug.log
index-cov.js
coverage.html
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ language: node_js
node_js:
- "0.10"
- "0.12"
after_success:
- npm run coveralls
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"description": "Pretty simple mocks for the CRUD and REST API",
"main": "index.js",
"scripts": {
"test": "mocha"
"test": "mocha",
"make-cov": "jscoverage index.js index-cov.js",
"cov": "npm run make-cov; SM_COV=1 mocha -R html-cov > coverage.html",
"coveralls": "npm run make-cov; SM_COV=1 mocha -R mocha-lcov-reporter | coveralls"
},
"repository": {
"type": "git",
Expand All @@ -25,7 +28,10 @@
},
"homepage": "https://github.com/shuvalov-anton/superagent-mocker",
"devDependencies": {
"coveralls": "^2.11.4",
"jscoverage": "^0.6.0",
"mocha": "^2.2.4",
"mocha-lcov-reporter": "^1.0.0",
"should": "^6.0.1",
"superagent": "^1.2.0"
},
Expand Down
13 changes: 11 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
* Dependencies
*/
var request = require('superagent');
var mock = require('./')(request);
var should = require('should');
var noop = function() {};
var mock = process.env.SM_COV
? require('./index-cov')(request)
: require('./index')(request);


describe('superagent mock', function() {

Expand Down Expand Up @@ -198,3 +200,10 @@ describe('superagent mock', function() {
});

});



/**
* Just noop
*/
function noop() {};

0 comments on commit 92e5877

Please sign in to comment.