From 994af98021be961fab9ee853fc28f49d6cad61f1 Mon Sep 17 00:00:00 2001 From: Gergely Danyi Date: Wed, 25 Oct 2023 03:10:02 -0500 Subject: [PATCH] Test fix --- .../__snapshots__/filter.test.ts.snap | 32 +++++++++++++++++++ client/__tests__/filter.test.ts | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 client/__tests__/__snapshots__/filter.test.ts.snap diff --git a/client/__tests__/__snapshots__/filter.test.ts.snap b/client/__tests__/__snapshots__/filter.test.ts.snap new file mode 100644 index 0000000..3e047ed --- /dev/null +++ b/client/__tests__/__snapshots__/filter.test.ts.snap @@ -0,0 +1,32 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`json path filter returns only selected fields 1`] = ` +{ + "data": { + "items": [ + { + "metadata": { + "name": "admin", + }, + }, + { + "metadata": { + "name": "aws-node", + }, + }, + ], + "kind": "ClusterRoleList", + }, + "headers": { + "audit-id": "6a816d03-d29f-4657-b624-35766c8a5572", + "cache-control": "no-cache, private", + "content-type": "application/json", + "date": "Wed, 25 Oct 2023 06:08:30 GMT", + "transfer-encoding": "chunked", + "x-kubernetes-pf-flowschema-uid": "ef7c3d21-4649-422d-a4fa-e5b85d52f141", + "x-kubernetes-pf-prioritylevel-uid": "a6704cd4-c4fb-48bb-982e-a1ed79bfb12d", + }, + "status": 200, + "statusText": "OK", +} +`; diff --git a/client/__tests__/filter.test.ts b/client/__tests__/filter.test.ts index c754f6f..4ceea1e 100644 --- a/client/__tests__/filter.test.ts +++ b/client/__tests__/filter.test.ts @@ -122,6 +122,6 @@ describe("json path filter", () => { "{ headers: .headers, status: .status, statusText: .statusText, data: { kind: .data.kind, items: [.data.items[] | { metadata: { name: .metadata.name } }] } }" ); - expect(result).toEqual(["admin", "aws-node"]); + expect(result).toMatchSnapshot(); }); });