Skip to content

Commit

Permalink
update key tests to ignore repeatable directive order (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
dariuszkuc committed Aug 12, 2022
1 parent 9a1e93f commit f8e0ea9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/tests/key.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ describe("repeatable @key", () => {

const { sdl } = serviceSDLQuery.data._service;
const normalizedSDL = stripIgnoredCharacters(sdl);
expect(normalizedSDL).toContain("type Product@key(fields:\"id\")@key(fields:\"sku package\")@key(fields:\"sku variation { id }\")");
expect(normalizedSDL).toMatch(/type Product.*@key\(fields:"id"\).*\{/);
// need to end regex with unique field in Product as otherwise we can match against DeprecatedProduct key
expect(normalizedSDL).toMatch(/type Product.*@key\(fields:"sku package"\).*variation/);
expect(normalizedSDL).toMatch(/type Product.*@key\(fields:"sku variation { id }"\).*\{/);
});

test("resolves multiple @key directives on Product", async () => {
Expand Down

0 comments on commit f8e0ea9

Please sign in to comment.