Skip to content

Commit b44191e

Browse files
authored
ignore ETAG query test as well, reuse skip util (#5639)
1 parent 8417c60 commit b44191e

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

Diff for: test/app.router.js

+2-16
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ var express = require('../')
66
, assert = require('assert')
77
, methods = require('methods');
88

9+
var shouldSkipQuery = require('./support/utils').shouldSkipQuery
10+
911
describe('app.router', function(){
1012
it('should restore req.params after leaving router', function(done){
1113
var app = express();
@@ -35,22 +37,6 @@ describe('app.router', function(){
3537
})
3638

3739
describe('methods', function(){
38-
function getMajorVersion(versionString) {
39-
return versionString.split('.')[0];
40-
}
41-
42-
function shouldSkipQuery(versionString) {
43-
// Temporarily skipping this test on 21 and 22
44-
// update this implementation to run on those release lines on supported versions once they exist
45-
// upstream tracking https://github.com/nodejs/node/pull/51719
46-
// express tracking issue: https://github.com/expressjs/express/issues/5615
47-
var majorsToSkip = {
48-
"21": true,
49-
"22": true
50-
}
51-
return majorsToSkip[getMajorVersion(versionString)]
52-
}
53-
5440
methods.concat('del').forEach(function(method){
5541
if (method === 'connect') return;
5642
if (method === 'query' && shouldSkipQuery(process.versions.node)) return

Diff for: test/res.send.js

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ var methods = require('methods');
77
var request = require('supertest');
88
var utils = require('./support/utils');
99

10+
var shouldSkipQuery = require('./support/utils').shouldSkipQuery
11+
1012
describe('res', function(){
1113
describe('.send()', function(){
1214
it('should set body to ""', function(done){
@@ -407,6 +409,7 @@ describe('res', function(){
407409

408410
methods.forEach(function (method) {
409411
if (method === 'connect') return;
412+
if (method === 'query' && shouldSkipQuery(process.versions.node)) return
410413

411414
it('should send ETag in response to ' + method.toUpperCase() + ' request', function (done) {
412415
var app = express();

Diff for: test/support/utils.js

+18
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ exports.shouldHaveBody = shouldHaveBody
1616
exports.shouldHaveHeader = shouldHaveHeader
1717
exports.shouldNotHaveBody = shouldNotHaveBody
1818
exports.shouldNotHaveHeader = shouldNotHaveHeader;
19+
exports.shouldSkipQuery = shouldSkipQuery
1920

2021
/**
2122
* Assert that a supertest response has a specific body.
@@ -70,3 +71,20 @@ function shouldNotHaveHeader(header) {
7071
assert.ok(!(header.toLowerCase() in res.headers), 'should not have header ' + header);
7172
};
7273
}
74+
75+
function getMajorVersion(versionString) {
76+
return versionString.split('.')[0];
77+
}
78+
79+
function shouldSkipQuery(versionString) {
80+
// Temporarily skipping this test on 21 and 22
81+
// update this implementation to run on those release lines on supported versions once they exist
82+
// upstream tracking https://github.com/nodejs/node/pull/51719
83+
// express tracking issue: https://github.com/expressjs/express/issues/5615
84+
var majorsToSkip = {
85+
"21": true,
86+
"22": true
87+
}
88+
return majorsToSkip[getMajorVersion(versionString)]
89+
}
90+

0 commit comments

Comments
 (0)