Skip to content

Commit 98191a8

Browse files
committed
adding test cases for http-lambda-proxy integration
1 parent 2ee391e commit 98191a8

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

test/config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,17 @@ module.exports = async () => {
7777
prefixRewrite: '/endpoint-proxy-methods-put',
7878
target: 'http://localhost:3000',
7979
methods: ['PUT']
80+
}, {
81+
prefix: '/lambda',
82+
proxyType: 'lambda',
83+
target: 'a-lambda-function-name',
84+
hooks: {
85+
async onRequest (req, res) {
86+
res.end('Go Serverless!')
87+
88+
return true
89+
}
90+
}
8091
}]
8192
}
8293
}

test/smoke.test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* global describe, it */
22
const expect = require('chai').expect
33
const request = require('supertest')
4-
const fastGateway = require('./../index')
4+
const fastGateway = require('../index')
55
const config = require('./config')
66

77
let remote, gateway
@@ -303,6 +303,14 @@ describe('API Gateway', () => {
303303
})
304304
})
305305

306+
it('GET /lambda/hi', async () => {
307+
await request(gateway)
308+
.get('/lambda/hi')
309+
.then((res) => {
310+
expect(res.text).to.equal('Go Serverless!')
311+
})
312+
})
313+
306314
it('close', async function () {
307315
this.timeout(10 * 1000)
308316

0 commit comments

Comments
 (0)