ignore ETAG query test as well, reuse skip util (#5639)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Jon Church · committed by GitHub · parent 8417c60 · Browse files · 3 files·+23 added−16 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+23 added−16 removed
- tests:+23 added−16 removed
Provenance
- Commit
b44191e- Tree
ff08060- Author
Jon Church <me@jonchurch.com>- Committer
GitHub <noreply@github.com>- Parent
8417c60
3 files changed+23 added−16 removed
modified:test/support/utils.js+18 added
14 unmodified lines15161718192021222346 unmodified lines70717273747576777879808182838485868788899014 unmodified linesexports.shouldHaveBody = shouldHaveBodyexports.shouldHaveHeader = shouldHaveHeaderexports.shouldNotHaveBody = shouldNotHaveBodyexports.shouldNotHaveHeader = shouldNotHaveHeader;exports.shouldSkipQuery = shouldSkipQuery
/** * Assert that a supertest response has a specific body. *46 unmodified lines return function (res) { 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)]}
modified:test/app.router.js+2 added-16 removed
4 unmodified lines5 , request = require('supertest')6 , assert = require('assert')7 , methods = require('methods');8 9+var shouldSkipQuery = require('./support/utils').shouldSkipQuery10+11 describe('app.router', function(){12 it('should restore req.params after leaving router', function(done){13 var app = express();14 var router = new express.Router();21 unmodified lines36 .expect(200, '1', done);37 })38 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 2244- // update this implementation to run on those release lines on supported versions once they exist45- // upstream tracking https://github.com/nodejs/node/pull/5171946- // express tracking issue: https://github.com/expressjs/express/issues/561547- var majorsToSkip = {48- "21": true,49- "22": true50- }51- return majorsToSkip[getMajorVersion(versionString)]52- }53-40 methods.concat('del').forEach(function(method){41 if (method === 'connect') return;42 if (method === 'query' && shouldSkipQuery(process.versions.node)) return43 1071 unmodified linesmodified:test/res.send.js+3 added
5 unmodified lines6 var methods = require('methods');7 var request = require('supertest');8 var utils = require('./support/utils');9 10+var shouldSkipQuery = require('./support/utils').shouldSkipQuery11+12 describe('res', function(){13 describe('.send()', function(){14 it('should set body to ""', function(done){15 var app = express();392 unmodified lines408 });409 410 methods.forEach(function (method) {411 if (method === 'connect') return;412+ if (method === 'query' && shouldSkipQuery(process.versions.node)) return413 414 it('should send ETag in response to ' + method.toUpperCase() + ' request', function (done) {415 var app = express();416 183 unmodified lines