File tree 3 files changed +23
-16
lines changed
3 files changed +23
-16
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ var express = require('../')
6
6
, assert = require ( 'assert' )
7
7
, methods = require ( 'methods' ) ;
8
8
9
+ var shouldSkipQuery = require ( './support/utils' ) . shouldSkipQuery
10
+
9
11
describe ( 'app.router' , function ( ) {
10
12
it ( 'should restore req.params after leaving router' , function ( done ) {
11
13
var app = express ( ) ;
@@ -35,22 +37,6 @@ describe('app.router', function(){
35
37
} )
36
38
37
39
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
-
54
40
methods . concat ( 'del' ) . forEach ( function ( method ) {
55
41
if ( method === 'connect' ) return ;
56
42
if ( method === 'query' && shouldSkipQuery ( process . versions . node ) ) return
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ var methods = require('methods');
7
7
var request = require ( 'supertest' ) ;
8
8
var utils = require ( './support/utils' ) ;
9
9
10
+ var shouldSkipQuery = require ( './support/utils' ) . shouldSkipQuery
11
+
10
12
describe ( 'res' , function ( ) {
11
13
describe ( '.send()' , function ( ) {
12
14
it ( 'should set body to ""' , function ( done ) {
@@ -407,6 +409,7 @@ describe('res', function(){
407
409
408
410
methods . forEach ( function ( method ) {
409
411
if ( method === 'connect' ) return ;
412
+ if ( method === 'query' && shouldSkipQuery ( process . versions . node ) ) return
410
413
411
414
it ( 'should send ETag in response to ' + method . toUpperCase ( ) + ' request' , function ( done ) {
412
415
var app = express ( ) ;
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ exports.shouldHaveBody = shouldHaveBody
16
16
exports . shouldHaveHeader = shouldHaveHeader
17
17
exports . shouldNotHaveBody = shouldNotHaveBody
18
18
exports . shouldNotHaveHeader = shouldNotHaveHeader ;
19
+ exports . shouldSkipQuery = shouldSkipQuery
19
20
20
21
/**
21
22
* Assert that a supertest response has a specific body.
@@ -70,3 +71,20 @@ function shouldNotHaveHeader(header) {
70
71
assert . ok ( ! ( header . toLowerCase ( ) in res . headers ) , 'should not have header ' + header ) ;
71
72
} ;
72
73
}
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
+
You can’t perform that action at this time.
0 commit comments