mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-29 13:52:46 -07:00
29 lines
831 B
TypeScript
29 lines
831 B
TypeScript
/* eslint-disable */
|
|
import { describe, it, expect } from 'vitest'
|
|
import { getRouteApi, createRoute } from '../src'
|
|
|
|
describe('getRouteApi', () => {
|
|
it('should have the useRouteContext hook', () => {
|
|
const api = getRouteApi('foo')
|
|
expect(api.useRouteContext).toBeDefined()
|
|
})
|
|
|
|
it('should have the useParams hook', () => {
|
|
const api = getRouteApi('foo')
|
|
expect(api.useParams).toBeDefined()
|
|
})
|
|
})
|
|
|
|
describe('createRoute has the same hooks as getRouteApi', () => {
|
|
const routeApi = getRouteApi('foo')
|
|
const hookNames = Object.keys(routeApi).filter((key) => key.startsWith('use'))
|
|
const route = createRoute({} as any)
|
|
|
|
it.each(hookNames.map((name) => [name]))(
|
|
'should have the "%s" hook defined',
|
|
(hookName) => {
|
|
expect(route[hookName as keyof typeof route]).toBeDefined()
|
|
},
|
|
)
|
|
})
|