Skip to content

Commit 71ecdeb

Browse files
Rolando Santamaria MasoRolando Santamaria Maso
authored andcommitted
improving querystring tests
1 parent 16733ae commit 71ecdeb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

test/config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ module.exports = async () => {
9292
target: 'http://localhost:3000',
9393
methods: ['GET'],
9494
hooks: {
95+
onRequest: (req) => {
96+
req.query.name = 'fast-gateway'
97+
},
9598
queryString: {
9699
name: 'qs-overwrite'
97100
}

test/smoke.test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,17 @@ describe('API Gateway', () => {
308308
})
309309
})
310310

311-
it('GET /qs - 200', async () => {
311+
it('(Should overwrite query string using req.query) GET /qs - 200', async () => {
312312
await request(gateway)
313-
.get('/qs')
313+
.get('/qs?name=nodejs&category=js')
314314
.expect(200)
315315
.then((response) => {
316316
expect(response.body.name).to.equal('fast-gateway')
317+
expect(response.body.category).to.equal('js')
317318
})
318319
})
319320

320-
it('GET /qs2 - 200', async () => {
321+
it('(Should overwrite query string using queryString option) GET /qs2 - 200', async () => {
321322
await request(gateway)
322323
.get('/qs2?name=fast-gateway')
323324
.expect(200)

0 commit comments

Comments
 (0)