Loading .jshintrc +3 −2 Original line number Diff line number Diff line Loading @@ -80,14 +80,15 @@ "rhino" : false, // Enable globals available when your code is running inside of the Rhino runtime environment. "wsh" : false, // Enable globals available when your code is running as a script for the Windows Script Host. // Additional globals introduced by Mocha // Additional globals introduced by Mocha and Chai "globals": { "describe" : false, "xdescribe" : false, "it" : false, "xit" : false, "before" : false, "after" : false "after" : false, "expect" : false }, // == JSLint Legacy =================================================== Loading gulpfile.js +3 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,9 @@ var mocha = require('gulp-mocha'); var chalk = require('chalk'); var rimraf = require('rimraf'); var chai = require("chai"); global.expect = chai.expect; var paths = { libJsFiles: './lib/**/*.js', Loading package.json +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ "request": "^2.34" }, "devDependencies": { "chai": "^1.9.2", "chalk": "^0.5.1", "gulp": "^3.8.8", "gulp-istanbul": "^0.3.1", Loading test/request-test.js +10 −24 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ var rp = require('../lib/rp.js'); var http = require('http'); var url = require('url'); var assert = require('assert'); var util = require('util'); describe('Request-Promise', function () { Loading Loading @@ -67,14 +66,11 @@ describe('Request-Promise', function () { .then(function () { done(new Error('A 500 response code should reject, not resolve')); }).catch(function (reason) { if (reason.options.method !== 'GET') { done(new Error(util.format("Expected method %s, got %s", 'GET', reason.options.method))); } else if (reason.error !== 'GET /500') { done(new Error(util.format("Expected body as '%s', got '%s'", "GET /500", reason.error))); } else { expect(reason.options.method).to.eql('GET'); expect(reason.error).to.eql('GET /500'); done(); } }); }) .catch(done); }); Loading Loading @@ -204,21 +200,11 @@ describe('Request-Promise', function () { }; rp(options) .then(function(response){ if (response.statusCode !== 200) { done(new Error(util.format("Expected response status %d, got %d", 200, response.statusCode))); } else if (response.request.method !== 'GET') { done(new Error(util.format("Expected method %s, got %s", 'GET', response.request.method))); } else if (response.body !== 'GET /200') { done(new Error(util.format("Expected body as '%s', got '%s'", "GET /200", response.body))); } else { expect(response.statusCode).to.eql(200); expect(response.request.method).to.eql('GET'); expect(response.body).to.eql('GET /200'); done(); } }).catch(function(err){ done(new Error(err)); }); }).catch(done); }); }); Loading Loading
.jshintrc +3 −2 Original line number Diff line number Diff line Loading @@ -80,14 +80,15 @@ "rhino" : false, // Enable globals available when your code is running inside of the Rhino runtime environment. "wsh" : false, // Enable globals available when your code is running as a script for the Windows Script Host. // Additional globals introduced by Mocha // Additional globals introduced by Mocha and Chai "globals": { "describe" : false, "xdescribe" : false, "it" : false, "xit" : false, "before" : false, "after" : false "after" : false, "expect" : false }, // == JSLint Legacy =================================================== Loading
gulpfile.js +3 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,9 @@ var mocha = require('gulp-mocha'); var chalk = require('chalk'); var rimraf = require('rimraf'); var chai = require("chai"); global.expect = chai.expect; var paths = { libJsFiles: './lib/**/*.js', Loading
package.json +1 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ "request": "^2.34" }, "devDependencies": { "chai": "^1.9.2", "chalk": "^0.5.1", "gulp": "^3.8.8", "gulp-istanbul": "^0.3.1", Loading
test/request-test.js +10 −24 Original line number Diff line number Diff line Loading @@ -3,7 +3,6 @@ var rp = require('../lib/rp.js'); var http = require('http'); var url = require('url'); var assert = require('assert'); var util = require('util'); describe('Request-Promise', function () { Loading Loading @@ -67,14 +66,11 @@ describe('Request-Promise', function () { .then(function () { done(new Error('A 500 response code should reject, not resolve')); }).catch(function (reason) { if (reason.options.method !== 'GET') { done(new Error(util.format("Expected method %s, got %s", 'GET', reason.options.method))); } else if (reason.error !== 'GET /500') { done(new Error(util.format("Expected body as '%s', got '%s'", "GET /500", reason.error))); } else { expect(reason.options.method).to.eql('GET'); expect(reason.error).to.eql('GET /500'); done(); } }); }) .catch(done); }); Loading Loading @@ -204,21 +200,11 @@ describe('Request-Promise', function () { }; rp(options) .then(function(response){ if (response.statusCode !== 200) { done(new Error(util.format("Expected response status %d, got %d", 200, response.statusCode))); } else if (response.request.method !== 'GET') { done(new Error(util.format("Expected method %s, got %s", 'GET', response.request.method))); } else if (response.body !== 'GET /200') { done(new Error(util.format("Expected body as '%s', got '%s'", "GET /200", response.body))); } else { expect(response.statusCode).to.eql(200); expect(response.request.method).to.eql('GET'); expect(response.body).to.eql('GET /200'); done(); } }).catch(function(err){ done(new Error(err)); }); }).catch(done); }); }); Loading