From 57c5427c261e04511705aa5522e4cd4a2e74ab21 Mon Sep 17 00:00:00 2001 From: Trevor Blades Date: Thu, 14 Sep 2023 12:00:25 -0700 Subject: [PATCH] Add test about name regex filtering --- src/graphql.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/graphql.test.ts b/src/graphql.test.ts index 4dc518b..0b7a862 100644 --- a/src/graphql.test.ts +++ b/src/graphql.test.ts @@ -41,6 +41,23 @@ it("returns filtered data", async () => { expect(result.data?.countries).toHaveLength(2); }); +it("filters names using a regular expression", async () => { + const result = await executor({ + document: query, + variables: { + filter: { + name: { + regex: "^United", + }, + }, + }, + }); + + assertSingleValue(result); + + expect(result.data?.countries).toHaveLength(3); +}); + it("filters a single value", async () => { const result = await executor({ document: query,