From 92b3a31a78f56fed3d12c04df36ae5d96ce8cf5d Mon Sep 17 00:00:00 2001 From: Lauri Nevala Date: Mon, 21 Dec 2020 17:35:14 +0200 Subject: [PATCH] Test other escaped characters do not cause issues Signed-off-by: Lauri Nevala --- src/renderer/utils/__tests__/jsonPath.test.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/renderer/utils/__tests__/jsonPath.test.tsx b/src/renderer/utils/__tests__/jsonPath.test.tsx index 7821afa6f0..53ef16dc05 100644 --- a/src/renderer/utils/__tests__/jsonPath.test.tsx +++ b/src/renderer/utils/__tests__/jsonPath.test.tsx @@ -7,6 +7,12 @@ describe("parseJsonPath", () => { expect(res).toBe(".metadata.labels['kubesphere.io/alias-name']"); }); + test("should convert keys with escpaped charatecrs to use indexed notation", () => { + const res = parseJsonPath(".metadata.labels.kubesphere\\\"io/alias-name"); + + expect(res).toBe(".metadata.labels['kubesphere\"io/alias-name']"); + }); + test("should convert '-' to use indexed notation", () => { const res = parseJsonPath(".metadata.labels.alias-name");