From a4cd3cbe2833c7d8020cc74c689de56abe407f02 Mon Sep 17 00:00:00 2001 From: Alec Aivazis Date: Thu, 28 Mar 2024 18:23:02 -0700 Subject: [PATCH] pass configFile to match tests --- packages/houdini/src/runtime/router/match.test.ts | 5 ++++- packages/houdini/src/runtime/router/match.ts | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/houdini/src/runtime/router/match.test.ts b/packages/houdini/src/runtime/router/match.test.ts index f0022225e..b7a54592f 100644 --- a/packages/houdini/src/runtime/router/match.test.ts +++ b/packages/houdini/src/runtime/router/match.test.ts @@ -1,5 +1,6 @@ import { test, expect, describe } from 'vitest' +import { testConfigFile } from '../../test' import { exec, find_match, parse_page_pattern } from './match' import type { RouterManifest } from './types' @@ -137,8 +138,10 @@ describe('find_match parse and match', async function () { ), } + const configFile = testConfigFile() + // find the match - const [match] = find_match(manifest, expected) + const [match] = find_match(configFile, manifest, expected) expect(match?.id).toEqual(expected) }) } diff --git a/packages/houdini/src/runtime/router/match.ts b/packages/houdini/src/runtime/router/match.ts index 19d28e8ff..d084917c9 100644 --- a/packages/houdini/src/runtime/router/match.ts +++ b/packages/houdini/src/runtime/router/match.ts @@ -42,6 +42,7 @@ export function find_match<_ComponentType>( // find the matching path (if it exists) let match: RouterPageManifest<_ComponentType> | null = null let matchVariables: GraphQLVariables = null + for (const page of Object.values(manifest.pages)) { // check if the current url matches const urlMatch = current.match(page.pattern)