diff --git a/test/app.router.js b/test/app.router.js index d9ddc69afc..ae87092f00 100644 --- a/test/app.router.js +++ b/test/app.router.js @@ -6,6 +6,8 @@ var express = require('../') , assert = require('assert') , methods = require('methods'); +var shouldSkipQuery = require('./support/utils').shouldSkipQuery + describe('app.router', function(){ it('should restore req.params after leaving router', function(done){ var app = express(); @@ -35,22 +37,6 @@ describe('app.router', function(){ }) describe('methods', function(){ - function getMajorVersion(versionString) { - return versionString.split('.')[0]; - } - - function shouldSkipQuery(versionString) { - // Temporarily skipping this test on 21 and 22 - // update this implementation to run on those release lines on supported versions once they exist - // upstream tracking https://github.com/nodejs/node/pull/51719 - // express tracking issue: https://github.com/expressjs/express/issues/5615 - var majorsToSkip = { - "21": true, - "22": true - } - return majorsToSkip[getMajorVersion(versionString)] - } - methods.concat('del').forEach(function(method){ if (method === 'connect') return; if (method === 'query' && shouldSkipQuery(process.versions.node)) return diff --git a/test/res.send.js b/test/res.send.js index c92568db6a..1e1835f823 100644 --- a/test/res.send.js +++ b/test/res.send.js @@ -7,6 +7,8 @@ var methods = require('methods'); var request = require('supertest'); var utils = require('./support/utils'); +var shouldSkipQuery = require('./support/utils').shouldSkipQuery + describe('res', function(){ describe('.send()', function(){ it('should set body to ""', function(done){ @@ -407,6 +409,7 @@ describe('res', function(){ methods.forEach(function (method) { if (method === 'connect') return; + if (method === 'query' && shouldSkipQuery(process.versions.node)) return it('should send ETag in response to ' + method.toUpperCase() + ' request', function (done) { var app = express(); diff --git a/test/support/utils.js b/test/support/utils.js index 5b4062e0b2..440a0269bc 100644 --- a/test/support/utils.js +++ b/test/support/utils.js @@ -16,6 +16,7 @@ exports.shouldHaveBody = shouldHaveBody exports.shouldHaveHeader = shouldHaveHeader exports.shouldNotHaveBody = shouldNotHaveBody exports.shouldNotHaveHeader = shouldNotHaveHeader; +exports.shouldSkipQuery = shouldSkipQuery /** * Assert that a supertest response has a specific body. @@ -70,3 +71,20 @@ function shouldNotHaveHeader(header) { assert.ok(!(header.toLowerCase() in res.headers), 'should not have header ' + header); }; } + +function getMajorVersion(versionString) { + return versionString.split('.')[0]; +} + +function shouldSkipQuery(versionString) { + // Temporarily skipping this test on 21 and 22 + // update this implementation to run on those release lines on supported versions once they exist + // upstream tracking https://github.com/nodejs/node/pull/51719 + // express tracking issue: https://github.com/expressjs/express/issues/5615 + var majorsToSkip = { + "21": true, + "22": true + } + return majorsToSkip[getMajorVersion(versionString)] +} +