conninfo.test.ts
This file
Path
adapters/lambda-edge/src/conninfo.test.ts
27 lines 路 626 bytes 路 TypeScript
Last changed by
feat(adapters): add the seven adapters as workspace packages (#5463)Yusuke Wadabefore adoptionb877827
History of this fileTake it
12345678910111213141516171819202122232425262728import { Context } from 'hono'import { getConnInfo } from './conninfo'import type { CloudFrontEdgeEvent } from './handler'
describe('getConnInfo', () => { it('Should info is valid', () => { const clientIp = Math.random().toString() const env = { event: { Records: [ { cf: { request: { clientIp, }, }, }, ], } as CloudFrontEdgeEvent, }
const c = new Context(new Request('http://localhost/'), { env }) const info = getConnInfo(c)
expect(info.remote.address).toBe(clientIp) })})