From f44a3da5684501e3cf61fe697be81570d06c38b4 Mon Sep 17 00:00:00 2001 From: Laurent Nguyen Date: Mon, 17 Aug 2020 09:50:57 +0200 Subject: [PATCH] Allow boolean partition key in graph visualization (#150) * Allow boolean pk values to be displayed * Add unit tests --- .../Graph/GraphExplorerComponent/GraphExplorer.test.tsx | 5 +++++ src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.tsx | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.test.tsx b/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.test.tsx index 348c43576..7f98595f8 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.test.tsx +++ b/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.test.tsx @@ -92,6 +92,11 @@ describe("getPkIdFromDocumentId", () => { expect(GraphExplorer.getPkIdFromDocumentId(doc, "mypk")).toEqual("[234, 'id']"); }); + it("should create pkid pair from partitioned graph (pk as boolean)", () => { + const doc = createFakeDoc({ id: "id", mypk: true }); + expect(GraphExplorer.getPkIdFromDocumentId(doc, "mypk")).toEqual("[true, 'id']"); + }); + it("should create pkid pair from partitioned graph (pk as valid array value)", () => { const doc = createFakeDoc({ id: "id", mypk: [{ id: "someid", _value: "pkvalue" }] }); expect(GraphExplorer.getPkIdFromDocumentId(doc, "mypk")).toEqual("['pkvalue', 'id']"); diff --git a/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.tsx b/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.tsx index de56d7015..aa939ef5e 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.tsx +++ b/src/Explorer/Graph/GraphExplorerComponent/GraphExplorer.tsx @@ -1371,7 +1371,7 @@ export class GraphExplorer extends React.Component 0) { // pk is [{ id: 'id', _value: 'value' }] pk = pk[0]["_value"];