Skip to content

Commit daaa05d

Browse files
committed
Update feedback reviewed
1 parent 576ce52 commit daaa05d

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

test/app.response.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,14 @@ describe('app', function(){
142142

143143
it('should deprecate when redirect called without a url', function (done) {
144144
var app = express()
145+
var warnings = []
146+
147+
// Capture deprecation warnings
148+
process.on('warning', function (warning) {
149+
if (warning.name === 'DeprecationWarning') {
150+
warnings.push(warning.message)
151+
}
152+
})
145153

146154
app.use(function (req, res) {
147155
res.redirect('')
@@ -151,11 +159,22 @@ describe('app', function(){
151159
.get('/')
152160
.expect(302)
153161
.expect('Location', '')
154-
.expect(/Redirecting to/, done)
162+
.expect(/Redirecting to/, function () {
163+
assert(warnings.some(msg => msg.includes('res.redirect(url): Use res.redirect(status, url) instead')))
164+
done()
165+
})
155166
})
156167

157168
it('should deprecate when redirect address is not a string', function (done) {
158169
var app = express()
170+
var warnings = []
171+
172+
// Capture deprecation warnings
173+
process.on('warning', function (warning) {
174+
if (warning.name === 'DeprecationWarning') {
175+
warnings.push(warning.message)
176+
}
177+
})
159178

160179
app.use(function (req, res) {
161180
res.redirect(302, 123)
@@ -165,7 +184,10 @@ describe('app', function(){
165184
.get('/')
166185
.expect(302)
167186
.expect('Location', '123')
168-
.expect(/Redirecting to 123/, done)
187+
.expect(/Redirecting to 123/, function () {
188+
assert(warnings.some(msg => msg.includes('res.redirect(url, status): Use res.redirect(status, url) instead')))
189+
done()
190+
})
169191
})
170192

171193
it('should raise when redirect status is not a number', function (done) {

0 commit comments

Comments
 (0)