-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,659 additions
and
791 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
.project | ||
.settings | ||
coverage | ||
node_modules | ||
test/results | ||
npm-debug.log |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,19 @@ node_js: | |
- "0.12" | ||
|
||
notifications: | ||
email: | ||
email: | ||
- "[email protected]" | ||
- "[email protected]" | ||
|
||
addons: | ||
code_climate: | ||
repo_token: 75dc20817d25bb52614e495f87d69b228edac0016fb096ccab2a75b624c68d4e | ||
|
||
before_script: | ||
- npm install -g gulp | ||
- npm install -g codeclimate-test-reporter | ||
- gulp lint | ||
|
||
after_script: | ||
- gulp coverage | ||
- codeclimate < ./coverage/lcov.info |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
'use strict'; | ||
|
||
var gulp = require('gulp'); | ||
var mocha = require('gulp-mocha'); | ||
var istanbul = require('gulp-istanbul'); | ||
var eslint = require('gulp-eslint'); | ||
|
||
var files = { | ||
src: ['./lib/**/*.js'], | ||
test: ['./test/**/*.spec.js'] | ||
}; | ||
|
||
gulp.task('lint', function () { | ||
return gulp.src(files.src.concat(files.test)) | ||
.pipe(eslint()) | ||
.pipe(eslint.format()) | ||
.pipe(eslint.failOnError()); | ||
}); | ||
|
||
gulp.task('test', function () { | ||
return gulp.src(files.test, {read: false}) | ||
.pipe(mocha({reporter: 'dot'})); | ||
}); | ||
|
||
gulp.task('spec', function () { | ||
return gulp.src(files.test, {read: false}) | ||
.pipe(mocha({reporter: 'spec'})); | ||
}); | ||
|
||
gulp.task('coverage', function (done) { | ||
gulp.src(files.src) | ||
.pipe(istanbul()) | ||
.pipe(istanbul.hookRequire()) | ||
.on('finish', function () { | ||
gulp.src(files.test) | ||
.pipe(mocha({reporter: 'dot'})) | ||
.pipe(istanbul.writeReports({ | ||
dir: './coverage', | ||
reporters: ['lcov', 'json', 'html'], | ||
reportOpts: { dir: './coverage' } | ||
})) | ||
.on('end', done); | ||
}); | ||
}); |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,21 +2,21 @@ | |
"author": "Howard Abrams <[email protected]> (http://www.github.com/howardabrams)", | ||
"name": "node-mocks-http", | ||
"description": "Mock 'http' objects for testing Express routing functions", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"homepage": "https://github.com/howardabrams/node-mocks-http", | ||
"bugs": { | ||
"url" : "https://github.com/howardabrams/node-mocks-http/issues" | ||
"url": "https://github.com/howardabrams/node-mocks-http/issues" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name" : "Howard Abrams", | ||
"email" : "[email protected]", | ||
"url" : "https://github.com/howardabrams" | ||
"name": "Howard Abrams", | ||
"email": "[email protected]", | ||
"url": "https://github.com/howardabrams" | ||
}, | ||
{ | ||
"name" : "Johnny Estilles", | ||
"email" : "[email protected]", | ||
"url" : "https://github.com/JohnnyEstilles" | ||
"name": "Johnny Estilles", | ||
"email": "[email protected]", | ||
"url": "https://github.com/JohnnyEstilles" | ||
} | ||
], | ||
"license": "MIT", | ||
|
@@ -43,12 +43,19 @@ | |
"mime": "^1.3.4" | ||
}, | ||
"devDependencies": { | ||
"chai": "^2.2.0", | ||
"eslint": "^0.18.0", | ||
"node-restify-errors": "git://github.com/m9dfukc/node-restify-errors.git", | ||
"nodeunit": "^0.9.1" | ||
"eslint-plugin-mocha": "^0.2.2", | ||
"gulp": "^3.8.11", | ||
"gulp-eslint": "^0.8.0", | ||
"gulp-istanbul": "^0.8.1", | ||
"gulp-mocha": "^2.0.1", | ||
"istanbul": "^0.3.13", | ||
"mocha": "^2.2.4", | ||
"sinon": "^1.14.1", | ||
"sinon-chai": "^2.7.0" | ||
}, | ||
"scripts": { | ||
"lint": "DEBUG=eslint:cli-engine node_modules/eslint/bin/eslint.js ./lib ./examples ./test", | ||
"test": "npm run lint && ./run-tests" | ||
"test": "gulp spec" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
{ | ||
"env": { | ||
"node": true | ||
}, | ||
|
||
"plugins": ["mocha"], | ||
|
||
"globals": { | ||
"describe": 1, | ||
"it": 1, | ||
"before": 1, | ||
"beforeEach": 1, | ||
"after": 1, | ||
"afterEach": 1 | ||
}, | ||
|
||
"rules": { | ||
"mocha/no-exclusive-tests": 2, | ||
"comma-dangle": 2, | ||
"no-alert": 2, | ||
"no-array-constructor": 2, | ||
"no-caller": 2, | ||
"no-catch-shadow": 2, | ||
"no-control-regex": 2, | ||
"no-debugger": 2, | ||
"no-div-regex": 2, | ||
"no-dupe-keys": 2, | ||
"no-else-return": 2, | ||
"no-empty": 2, | ||
"no-empty-class": 2, | ||
"no-eq-null": 2, | ||
"no-eval": 2, | ||
"no-ex-assign": 2, | ||
"no-func-assign": 0, | ||
"no-floating-decimal": 2, | ||
"no-implied-eval": 2, | ||
"no-with": 2, | ||
"no-fallthrough": 2, | ||
"no-unreachable": 2, | ||
"no-undef": 2, | ||
"no-undef-init": 2, | ||
"no-unused-expressions": 0, | ||
"no-octal": 2, | ||
"no-octal-escape": 2, | ||
"no-obj-calls": 2, | ||
"no-multi-str": 2, | ||
"no-new-wrappers": 2, | ||
"no-new": 2, | ||
"no-new-func": 2, | ||
"no-native-reassign": 2, | ||
"no-delete-var": 2, | ||
"no-return-assign": 2, | ||
"no-new-object": 2, | ||
"no-label-var": 2, | ||
"no-self-compare": 2, | ||
"no-sync": 2, | ||
"no-loop-func": 2, | ||
"no-empty-label": 2, | ||
"no-unused-vars": 1, | ||
"no-script-url": 2, | ||
"no-proto": 2, | ||
"no-iterator": 2, | ||
"no-mixed-requires": [0, false], | ||
"no-wrap-func": 2, | ||
"no-shadow": 2, | ||
"no-use-before-define": 2, | ||
"no-redeclare": 2, | ||
"no-regex-spaces": 2, | ||
"no-mixed-spaces-and-tabs": 2, | ||
"no-underscore-dangle": 0, | ||
|
||
"brace-style": 2, | ||
"camelcase": 2, | ||
"consistent-this": [2, "self"], | ||
"curly": 2, | ||
"dot-notation": 2, | ||
"eqeqeq": 2, | ||
"new-cap": 2, | ||
"new-parens": 2, | ||
"quotes": [2, "single"], | ||
"semi": 2, | ||
"strict": [2, "global"], | ||
"use-isnan": 2, | ||
"valid-typeof": 2, | ||
"wrap-iife": 2, | ||
"indent": [2, 2, {"indentSwitchCase": true}] | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
var chai = require('chai'); | ||
var expect = chai.expect; | ||
|
||
var httpMock; | ||
|
||
describe('http-mock', function() { | ||
before(function() { | ||
httpMock = require('../../lib/http-mock'); | ||
}); | ||
|
||
it('should export .createRequest()', function() { | ||
expect(httpMock.createRequest).to.be.a('function'); | ||
}); | ||
|
||
it('should export .createResponse()', function() { | ||
expect(httpMock.createResponse).to.be.a('function'); | ||
}); | ||
|
||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
'use strict'; | ||
|
||
var chai = require('chai'); | ||
var expect = chai.expect; | ||
|
||
var MockEventEmitter = require('../../lib/mockEventEmitter'); | ||
var mockEventEmitter; | ||
|
||
describe('mockEventEmitter', function() { | ||
|
||
before(function() { | ||
mockEventEmitter = new MockEventEmitter(); | ||
}); | ||
|
||
it('should be a function', function() { | ||
expect(MockEventEmitter).to.be.a('function'); | ||
}); | ||
|
||
it('should be an object factory', function() { | ||
expect(mockEventEmitter).to.be.a('object'); | ||
expect(mockEventEmitter).to.be.an.instanceof(MockEventEmitter); | ||
}); | ||
|
||
it('should expose "MockEventEmitter" prototype', function() { | ||
expect(mockEventEmitter).to.have.property('addListener'); | ||
expect(mockEventEmitter.addListener).to.be.a('function'); | ||
|
||
expect(mockEventEmitter).to.have.property('on'); | ||
expect(mockEventEmitter.on).to.be.a('function'); | ||
|
||
expect(mockEventEmitter).to.have.property('once'); | ||
expect(mockEventEmitter.once).to.be.a('function'); | ||
|
||
expect(mockEventEmitter).to.have.property('removeListener'); | ||
expect(mockEventEmitter.removeListener).to.be.a('function'); | ||
|
||
expect(mockEventEmitter).to.have.property('removeAllListeners'); | ||
expect(mockEventEmitter.removeAllListeners).to.be.a('function'); | ||
|
||
expect(mockEventEmitter).to.have.property('setMaxListeners'); | ||
expect(mockEventEmitter.setMaxListeners).to.be.a('function'); | ||
|
||
expect(mockEventEmitter).to.have.property('listeners'); | ||
expect(mockEventEmitter.listeners).to.be.a('function'); | ||
|
||
expect(mockEventEmitter).to.have.property('emit'); | ||
expect(mockEventEmitter.emit).to.be.a('function'); | ||
}); | ||
|
||
it('should return undefined when methods called', function() { | ||
expect(mockEventEmitter.addListener()).to.be.undefined; | ||
expect(mockEventEmitter.on()).to.be.undefined; | ||
expect(mockEventEmitter.once()).to.be.undefined; | ||
expect(mockEventEmitter.removeListener()).to.be.undefined; | ||
expect(mockEventEmitter.removeAllListeners()).to.be.undefined; | ||
expect(mockEventEmitter.setMaxListeners()).to.be.undefined; | ||
expect(mockEventEmitter.listeners()).to.be.undefined; | ||
expect(mockEventEmitter.emit()).to.be.undefined; | ||
}); | ||
|
||
}); |
Oops, something went wrong.