Skip to content

Commit 3b1584f

Browse files
committed
Test result-summary TS declarations
1 parent 804a3ea commit 3b1584f

File tree

2 files changed

+90
-1
lines changed

2 files changed

+90
-1
lines changed

test/types/v1/result-summary.test.ts

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/**
2+
* Copyright (c) 2002-2017 "Neo Technology,","
3+
* Network Engine for Objects in Lund AB [http://neotechnology.com]
4+
*
5+
* This file is part of Neo4j.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
import ResultSummary, {
21+
Notification,
22+
NotificationPosition,
23+
Plan,
24+
ProfiledPlan,
25+
ServerInfo,
26+
StatementStatistic
27+
} from "../../../types/v1/result-summary";
28+
import Integer from "../../../types/v1/integer";
29+
30+
const dummy: any = null;
31+
32+
const sum: ResultSummary = dummy;
33+
34+
const stmt = sum.statement;
35+
const stmtText: string = stmt.text;
36+
const stmtParams: object = stmt.parameters;
37+
38+
const str: string = sum.statementType;
39+
40+
const counters: StatementStatistic = sum.counters;
41+
42+
const containsUpdates: boolean = counters.containsUpdates();
43+
const nodesCreated: number = counters.nodesCreated();
44+
const nodesDeleted: number = counters.nodesDeleted();
45+
const relationshipsCreated: number = counters.relationshipsCreated();
46+
const relationshipsDeleted: number = counters.relationshipsDeleted();
47+
const propertiesSet: number = counters.propertiesSet();
48+
const labelsAdded: number = counters.labelsAdded();
49+
const labelsRemoved: number = counters.labelsRemoved();
50+
const indexesAdded: number = counters.indexesAdded();
51+
const indexesRemoved: number = counters.indexesRemoved();
52+
const constraintsAdded: number = counters.constraintsAdded();
53+
const constraintsRemoved: number = counters.constraintsRemoved();
54+
55+
const plan: Plan = sum.plan;
56+
const planOperatorType: string = plan.operatorType;
57+
const planIdentifiers: string[] = plan.identifiers;
58+
const planArguments: { [key: string]: string } = plan.arguments;
59+
const planChildren: Plan[] = plan.children;
60+
61+
const profile: ProfiledPlan = sum.profile;
62+
const profileOperatorType: string = profile.operatorType;
63+
const profileIdentifiers: string[] = profile.identifiers;
64+
const profileArguments: { [key: string]: string } = profile.arguments;
65+
const profileDbHits: number = profile.dbHits;
66+
const profileRows: number = profile.rows;
67+
const profileChildren: ProfiledPlan[] = profile.children;
68+
69+
const notifications: Notification[] = sum.notifications;
70+
const notification: Notification = notifications[0];
71+
const code: string = notification.code;
72+
const title: string = notification.title;
73+
const description: string = notification.description;
74+
const severity: string = notification.severity;
75+
const position1: {} = notification.position;
76+
const position2: NotificationPosition = <NotificationPosition>notification.position;
77+
const offset: number = position2.offset;
78+
const line: number = position2.line;
79+
const column: number = position2.column;
80+
81+
const server: ServerInfo = sum.server;
82+
const address: string = server.address;
83+
const version: string = server.version;
84+
85+
const resultConsumedAfter: Integer = sum.resultConsumedAfter;
86+
const resultAvailableAfter: Integer = sum.resultAvailableAfter;
87+
88+
const hasPlan: boolean = sum.hasPlan();
89+
const hasProfile: boolean = sum.hasProfile();

types/v1/result-summary.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,6 @@ declare const statementType: {
9999
SCHEMA_WRITE: "s";
100100
};
101101

102-
export {statementType}
102+
export {statementType, Plan, ProfiledPlan, StatementStatistic, Notification, ServerInfo, NotificationPosition}
103103

104104
export default ResultSummary;

0 commit comments

Comments
 (0)