conninfo.test.ts
This file
Path
adapters/vercel/src/conninfo.test.ts
18 lines 路 424 bytes 路 TypeScript
Last changed by
feat(adapters): add the seven adapters as workspace packages (#5463)Yusuke Wadabefore adoptionb877827
History of this fileTake it
12345678910111213141516171819import { Context } from 'hono'import { getConnInfo } from './conninfo'
describe('getConnInfo', () => { it('Should getConnInfo works', () => { const address = Math.random().toString() const req = new Request('http://localhost/', { headers: { 'x-real-ip': address, }, }) const c = new Context(req)
const info = getConnInfo(c)
expect(info.remote.address).toBe(address) })})