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>
This commit is contained in:
Josh Story 2023-06-30 03:11:24 -07:00 committed by GitHub
parent 0fb5fa550c
commit d02f60b998
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
}
}
}