Skip to content

Commit

Permalink
test: extend test case with catch_all param
Browse files Browse the repository at this point in the history
  • Loading branch information
ghornyak_gartner committed Aug 15, 2024
1 parent dd23cd0 commit 4421575
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/create-navigation-config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,12 @@ describe('createNavigationConfig', () => {
describe('when path has multiple route params', () => {
const { routes } = createNavigationConfig((defineRoute) => ({
organizationUser: defineRoute(
'/organizations/[orgId]/users/[userId]',
'/organizations/[orgId]/users/[userId]/[[...catch_all]]',
{
params: z.object({
orgId: z.string(),
userId: z.string(),
catch_all: z.array(z.string()).default([])
}),
},
),
Expand All @@ -168,8 +169,8 @@ describe('createNavigationConfig', () => {
});

expect(
routes.organizationUser({ orgId: 'org_123', userId: 'user_123' }),
).toBe('/organizations/org_123/users/user_123');
routes.organizationUser({ orgId: 'org_123', userId: 'user_123', catch_all: ['channel_123'] }),
).toBe('/organizations/org_123/users/user_123/channel_123');
});

it('exposes method to validate only params', () => {
Expand Down

0 comments on commit 4421575

Please sign in to comment.