From d02f60b99877f90a2c669cff9879bf736b6f3507 Mon Sep 17 00:00:00 2001 From: Josh Story Date: Fri, 30 Jun 2023 03:11:24 -0700 Subject: [PATCH] Loosen metatdata test matcher (#52007) the metadata tests have an unnecessarily strict matcher which will fail if the matched metadata isn't the first instance of the element tag type. This will cause a problem when we start to preload bootstrap scripts which will cause preload links in all test cases that did not come from the metadata api itself Co-authored-by: Jiachi Liu <4800338+huozhi@users.noreply.github.com> --- test/e2e/app-dir/metadata/metadata.test.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/e2e/app-dir/metadata/metadata.test.ts b/test/e2e/app-dir/metadata/metadata.test.ts index 40285c99ae..1f74967b22 100644 --- a/test/e2e/app-dir/metadata/metadata.test.ts +++ b/test/e2e/app-dir/metadata/metadata.test.ts @@ -31,7 +31,9 @@ createNextDescribe( if (Array.isArray(expected)) { expect(values).toEqual(expected) } else { - expect(values[0]).toBe(expected) + // If expected is undefined, then it should not exist. + // Otherwise, it should exist in the matched values. + expect(values.includes(expected)).toBe(expected !== undefined) } } }