Files
vercel/packages/remix/test/unit.is-layout-route.test.ts
Nathan Rajlich 63211b8b89 [remix] Add unit tests (#9469)
Moves parts of the `@vercel/remix` builder into util functions that have isolated unit tests. No functionality changes.
2023-02-17 18:46:33 +00:00

22 lines
694 B
TypeScript
Vendored

import { isLayoutRoute } from '../src/utils';
describe('isLayoutRoute()', () => {
const routes = [
{ id: 'root' },
{ id: 'routes/auth', parentId: 'root' },
{ id: 'routes/login', parentId: 'routes/auth' },
{ id: 'routes/logout', parentId: 'routes/auth' },
{ id: 'routes/index', parentId: 'root' },
];
it.each([
{ id: 'root', expected: true },
{ id: 'routes/auth', expected: true },
{ id: 'routes/index', expected: false },
{ id: 'routes/login', expected: false },
{ id: 'routes/logout', expected: false },
])('should return `$expected` for "$id" route', ({ id, expected }) => {
expect(isLayoutRoute(id, routes)).toEqual(expected);
});
});