Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

config.test.ts

33 lines824 Bytes

1import { join } from 'node:path'
2import { describe, expect, it } from 'vitest'
3​
4import { getConfig } from '../src'
5​
6function makeFolderDir(folder: string) {
7 return join(process.cwd(), 'tests', 'config', folder)
8}
9​
10type TestCases = Array<{
11 folder: string
12}>
13​
14describe('load config tests', () => {
15 it.each([
16 {
17 folder: 'json-config',
18 },
19 ] satisfies TestCases)(
20 'should load config correctly: $folder',
21 async ({ folder }) => {
22 const absPath = makeFolderDir(folder)
23 const resolvedConfig = getConfig({}, absPath)
24 expect(resolvedConfig).toEqual(
25 expect.objectContaining({
26 disableLogging: true,
27 routesDirectory: join(absPath, './configured-routes-path'),
28 generatedRouteTree: join(absPath, './routeTree.gen.ts'),
29 }),
30 )
31 },
32 )
33})