File tree Expand file tree Collapse file tree 1 file changed +18
-3
lines changed
Expand file tree Collapse file tree 1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change 11import { Hono } from '../../hono'
22import { handle } from './handler'
33
4+ type NetlifyContext = {
5+ geo : {
6+ city : string
7+ country : { code : string ; name : string }
8+ }
9+ ip : string
10+ requestId : string
11+ }
12+
13+ type Env = {
14+ Bindings : {
15+ context : NetlifyContext
16+ }
17+ }
18+
419describe ( 'Netlify Adapter' , ( ) => {
520 // Mock Netlify context
6- const createMockContext = ( overrides = { } ) => ( {
21+ const createMockContext = ( overrides = { } ) : NetlifyContext => ( {
722 geo : {
823 city : 'San Francisco' ,
924 country : { code : 'US' , name : 'United States' } ,
@@ -88,7 +103,7 @@ describe('Netlify Adapter', () => {
88103
89104 describe ( 'Context Handling' , ( ) => {
90105 it ( 'Should pass Netlify context to Hono env' , async ( ) => {
91- const app = new Hono ( )
106+ const app = new Hono < Env > ( )
92107 app . get ( '/' , ( c ) => {
93108 const netlifyCtx = c . env . context
94109 return c . json ( {
@@ -111,7 +126,7 @@ describe('Netlify Adapter', () => {
111126 } )
112127
113128 it ( 'Should access geo information from context' , async ( ) => {
114- const app = new Hono ( )
129+ const app = new Hono < Env > ( )
115130 app . get ( '/geo' , ( c ) => {
116131 const { geo } = c . env . context
117132 return c . json ( {
You can’t perform that action at this time.
0 commit comments