Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore ETAG query test on 21 and 22, reuse skip util #5639

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions test/app.router.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions test/res.send.js
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down Expand Up @@ -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();
Expand Down
18 changes: 18 additions & 0 deletions test/support/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)]
}

Loading