Skip to content
Myr

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 file

Take it

feat(adapters): add the seven adapters as workspace packages (#5463)Yusuke Wadabefore adoptionb877827

lines 1–27why, one step back
1import { Context } from 'hono'
2import { getConnInfo } from './conninfo'3import type { CloudFrontEdgeEvent } from './handler'45describe('getConnInfo', () => {6 it('Should info is valid', () => {7 const clientIp = Math.random().toString()8 const env = {9 event: {10 Records: [11 {12 cf: {13 request: {14 clientIp,15 },16 },17 },18 ],19 } as CloudFrontEdgeEvent,20 }2122 const c = new Context(new Request('http://localhost/'), { env })23 const info = getConnInfo(c)2425 expect(info.remote.address).toBe(clientIp)26 })27})