Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/adapters/hono/middleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ type Database = {
Relationships: []
}
}
Views: {}
Functions: {}
Enums: {}
CompositeTypes: {}
}
}

Expand Down Expand Up @@ -61,9 +57,13 @@ describe('hono supabase middleware', () => {
const app = new Hono<TypedEnv>()
app.use('*', withSupabase({ auth: 'none', env }))
app.get('/', (c) => {
const ctx = c.get('supabaseContext')
expectTypeOf(ctx).toEqualTypeOf<SupabaseContext<Database>>()
return c.json({ authMode: ctx.authMode })
// Hono provides two ways to get typed Supabse Context
const getCtx = c.get('supabaseContext')
const varCtx = c.var.supabaseContext
expect(getCtx).toBe(varCtx)

expectTypeOf(getCtx).toEqualTypeOf<SupabaseContext<Database>>()
return c.json({ authMode: getCtx.authMode })
})
const res = await app.request('/')
expect(res.status).toBe(200)
Expand Down
Loading