From 9593407677597d0aeee0db93eed6b9e50dc2815b Mon Sep 17 00:00:00 2001 From: sunilyadav840 Date: Mon, 23 Aug 2021 21:21:17 +0530 Subject: [PATCH] fixed logger.test.ts GraphData.test.ts securityWarningBar.tsx typescript in strict mode --- src/Common/Logger.test.ts | 2 -- .../GraphExplorerComponent/GraphData.test.ts | 24 +++++++++---------- .../Graph/GraphExplorerComponent/GraphData.ts | 4 ++-- .../SecurityWarningBar/SecurityWarningBar.tsx | 2 +- tsconfig.strict.json | 15 ++++++++---- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/Common/Logger.test.ts b/src/Common/Logger.test.ts index d2d873c9b..fc4875dd5 100644 --- a/src/Common/Logger.test.ts +++ b/src/Common/Logger.test.ts @@ -1,7 +1,5 @@ jest.mock("./MessageHandler"); -import { LogEntryLevel } from "../Contracts/Diagnostics"; import * as Logger from "./Logger"; -import { MessageTypes } from "../Contracts/ExplorerContracts"; import { sendMessage } from "./MessageHandler"; describe("Logger", () => { diff --git a/src/Explorer/Graph/GraphExplorerComponent/GraphData.test.ts b/src/Explorer/Graph/GraphExplorerComponent/GraphData.test.ts index 11b50ea7c..bd91e2ffc 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/GraphData.test.ts +++ b/src/Explorer/Graph/GraphExplorerComponent/GraphData.test.ts @@ -1,11 +1,11 @@ -import { GraphData, GremlinVertex, GremlinEdge } from "./GraphData"; +import { GraphData, GremlinEdge, GremlinVertex } from "./GraphData"; describe("Graph Data", () => { it("should set only one node as root", () => { const graphData = new GraphData(); - const v1: GremlinVertex = { id: "1", label: null }; - const v2: GremlinVertex = { id: "2", label: null }; - const v3: GremlinVertex = { id: "3", label: null }; + const v1: GremlinVertex = { id: "1", label: undefined }; + const v2: GremlinVertex = { id: "2", label: undefined }; + const v3: GremlinVertex = { id: "3", label: undefined }; v3._isRoot = true; graphData.addVertex(v1); @@ -28,9 +28,9 @@ describe("Graph Data", () => { it("should properly find root id", () => { const graphData = new GraphData(); - const v1: GremlinVertex = { id: "1", label: null }; - const v2: GremlinVertex = { id: "2", label: null }; - const v3: GremlinVertex = { id: "3", label: null }; + const v1: GremlinVertex = { id: "1", label: undefined }; + const v2: GremlinVertex = { id: "2", label: undefined }; + const v3: GremlinVertex = { id: "3", label: undefined }; graphData.addVertex(v1); graphData.addVertex(v2); @@ -44,12 +44,12 @@ describe("Graph Data", () => { it("should remove edge from graph", () => { const graphData = new GraphData(); - graphData.addVertex({ id: "v1", label: null }); - graphData.addVertex({ id: "v2", label: null }); - graphData.addVertex({ id: "v3", label: null }); + graphData.addVertex({ id: "v1", label: undefined }); + graphData.addVertex({ id: "v2", label: undefined }); + graphData.addVertex({ id: "v3", label: undefined }); - graphData.addEdge({ id: "e1", inV: "v1", outV: "v2", label: null }); - graphData.addEdge({ id: "e2", inV: "v1", outV: "v3", label: null }); + graphData.addEdge({ id: "e1", inV: "v1", outV: "v2", label: "" }); + graphData.addEdge({ id: "e2", inV: "v1", outV: "v3", label: "" }); // in edge graphData.removeEdge("e1", false); diff --git a/src/Explorer/Graph/GraphExplorerComponent/GraphData.ts b/src/Explorer/Graph/GraphExplorerComponent/GraphData.ts index 6b7bbd458..fd1c2b680 100644 --- a/src/Explorer/Graph/GraphExplorerComponent/GraphData.ts +++ b/src/Explorer/Graph/GraphExplorerComponent/GraphData.ts @@ -1,5 +1,5 @@ +import { SimulationLinkDatum, SimulationNodeDatum } from "d3"; import _ from "underscore"; -import { SimulationNodeDatum, SimulationLinkDatum } from "d3"; export interface PaginationInfo { total: number; @@ -10,7 +10,7 @@ export interface PaginationInfo { export interface GremlinVertex { id: string; - label: string; + label?: string; inE?: { [label: string]: GremlinShortInEdge[] }; outE?: { [label: string]: GremlinShortOutEdge[] }; properties?: { [propName: string]: GremlinProperty[] }; diff --git a/src/Explorer/Notebook/SecurityWarningBar/SecurityWarningBar.tsx b/src/Explorer/Notebook/SecurityWarningBar/SecurityWarningBar.tsx index 49575d0d7..e53bed3a6 100644 --- a/src/Explorer/Notebook/SecurityWarningBar/SecurityWarningBar.tsx +++ b/src/Explorer/Notebook/SecurityWarningBar/SecurityWarningBar.tsx @@ -66,7 +66,7 @@ interface InitialProps { } // Redux -const makeMapStateToProps = (state: AppState, initialProps: InitialProps) => { +const makeMapStateToProps = (_state: AppState, initialProps: InitialProps) => { const mapStateToProps = (state: AppState): StateProps => ({ isNotebookUntrusted: NotebookUtil.isNotebookUntrusted(state, initialProps.contentRef), }); diff --git a/tsconfig.strict.json b/tsconfig.strict.json index ee037db87..0ddda2caa 100644 --- a/tsconfig.strict.json +++ b/tsconfig.strict.json @@ -8,6 +8,8 @@ "noUnusedParameters": true }, "files": [ + "./src/Explorer/Graph/GraphExplorerComponent/GraphData.test.ts", + "./src/Common/Logger.test.ts", "./src/AuthType.ts", "./src/Bindings/ReactBindingHandler.ts", "./src/Common/ArrayHashMap.ts", @@ -55,6 +57,7 @@ "./src/Explorer/Notebook/NotebookContentItem.ts", "./src/Explorer/Notebook/NotebookRenderer/AzureTheme.tsx", "./src/Explorer/Notebook/NotebookRenderer/Prompt.tsx", + "./src/Explorer/Notebook/NotebookRenderer/PromptContent.test.tsx", "./src/Explorer/Notebook/NotebookRenderer/PromptContent.tsx", "./src/Explorer/Notebook/NotebookRenderer/StatusBar.tsx", "./src/Explorer/Notebook/NotebookRenderer/decorators/CellCreator.tsx", @@ -62,6 +65,7 @@ "./src/Explorer/Notebook/NotebookUtil.ts", "./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerSplashScreen.tsx", "./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerUtils.ts", + "./src/Explorer/Notebook/SecurityWarningBar/SecurityWarningBar.tsx", "./src/Explorer/OpenFullScreen.test.tsx", "./src/Explorer/OpenFullScreen.tsx", "./src/Explorer/Panes/PanelContainerComponent.test.tsx", @@ -82,10 +86,13 @@ "./src/Explorer/Tree/AccessibleVerticalList.ts", "./src/GitHub/GitHubConnector.ts", "./src/HostedExplorerChildFrame.ts", + "./src/Index.tsx", "./src/Platform/Hosted/Authorization.ts", "./src/Platform/Hosted/Components/MeControl.test.tsx", "./src/Platform/Hosted/Components/MeControl.tsx", "./src/Platform/Hosted/Components/SignInButton.tsx", + "./src/Platform/Hosted/Components/SwitchAccount.tsx", + "./src/Platform/Hosted/Components/SwitchSubscription.tsx", "./src/Platform/Hosted/HostedUtils.test.ts", "./src/Platform/Hosted/HostedUtils.ts", "./src/Platform/Hosted/extractFeatures.test.ts", @@ -129,17 +136,15 @@ "./src/hooks/useFullScreenURLs.tsx", "./src/hooks/useGraphPhoto.tsx", "./src/hooks/useNotebookSnapshotStore.ts", - "./src/hooks/usePortalAccessToken.tsx", "./src/hooks/useNotificationConsole.ts", "./src/hooks/useObservable.ts", + "./src/hooks/usePortalAccessToken.tsx", "./src/hooks/useSidePanel.ts", "./src/i18n.ts", "./src/quickstart.ts", "./src/setupTests.ts", "./src/userContext.test.ts", - "src/Common/EntityValue.tsx", - "./src/Platform/Hosted/Components/SwitchAccount.tsx", - "./src/Platform/Hosted/Components/SwitchSubscription.tsx" + "src/Common/EntityValue.tsx" ], "include": [ "src/CellOutputViewer/transforms/**/*", @@ -165,4 +170,4 @@ "src/Terminal/**/*", "src/Utils/arm/**/*" ] -} +} \ No newline at end of file