Skip to content

Commit 7c763e9

Browse files
author
Zhen Li
committed
Removing tck and moving tests into unit tests
1 parent ca002c5 commit 7c763e9

15 files changed

+90
-1244
lines changed

test/resources/derived.cert

Lines changed: 0 additions & 20 deletions
This file was deleted.

test/resources/derived.key

Lines changed: 0 additions & 27 deletions
This file was deleted.

test/resources/other.cert

Lines changed: 0 additions & 11 deletions
This file was deleted.

test/resources/other.key

Lines changed: 0 additions & 16 deletions
This file was deleted.

test/resources/root.cert

Lines changed: 0 additions & 21 deletions
This file was deleted.

test/resources/root.key

Lines changed: 0 additions & 27 deletions
This file was deleted.

test/v1/session.test.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ describe('session', () => {
351351
session.beginTransaction();
352352

353353
// Then
354-
expect(session.beginTransaction).toThrowError(
354+
expect(()=>session.beginTransaction()).toThrowError(
355355
/You cannot begin a transaction on a session with an open transaction/);
356356
});
357357

@@ -895,10 +895,6 @@ describe('session', () => {
895895
});
896896

897897
it('should send multiple bookmarks', async () => {
898-
if (!serverIs31OrLater()) {
899-
return;
900-
}
901-
902898
const nodeCount = 17;
903899
const bookmarks = [];
904900
for (let i = 0; i < nodeCount; i++) {

test/v1/summary.test.js

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('result summary', () => {
3535
driver.close();
3636
});
3737

38-
fit('should get result summary', done => {
38+
it('should get result summary', done => {
3939
// When & Then
4040
session.run("CREATE (p:Person { Name: 'Test'})").then(result => {
4141
var summary = result.summary;
@@ -65,4 +65,74 @@ describe('result summary', () => {
6565
done();
6666
});
6767
});
68+
69+
it('should get plan from summary', done => {
70+
session.run("EXPLAIN MATCH (n) RETURN 1").then(result => {
71+
var summary = result.summary;
72+
expect(summary.plan).toBeDefined();
73+
expect(summary.profile).toBe(false);
74+
75+
var plan = summary.plan;
76+
expect(plan.arguments).toBeDefined();
77+
expect(plan.children).toBeDefined();
78+
expect(plan.identifiers).toBeDefined();
79+
expect(plan.operatorType).toBeDefined();
80+
done();
81+
});
82+
});
83+
84+
it('should get profile from summary', done => {
85+
session.run("PROFILE RETURN 1").then(result => {
86+
var summary = result.summary;
87+
expect(summary.plan).toBeDefined();
88+
expect(summary.profile).toBeDefined();
89+
90+
var profile = summary.profile;
91+
var plan = summary.plan;
92+
93+
verifyPlansAreEqual(profile, plan);
94+
95+
expect(profile.dbHits).toBe(0);
96+
expect(profile.rows).toBe(1);
97+
98+
done();
99+
});
100+
});
101+
102+
it('should get notifications from summary', done => {
103+
session.run("EXPLAIN MATCH (n), (m) RETURN n, m").then(result => {
104+
var summary = result.summary;
105+
expect(summary.notifications).toBeDefined();
106+
expect(summary.notifications.length).toBe(1);
107+
var notification = summary.notifications[0];
108+
109+
expect(notification.code).toBeDefined();
110+
expect(notification.title).toBeDefined();
111+
expect(notification.description).toBeDefined();
112+
expect(notification.severity).toBeDefined();
113+
expect(notification.position).toBeDefined();
114+
115+
done();
116+
});
117+
});
118+
119+
function verifyPlansAreEqual(plan1, plan2) {
120+
expect(plan1.arguments).toBe(plan2.arguments);
121+
expect(plan1.identifiers).toBe(plan2.identifiers);
122+
expect(plan1.operatorType).toBe(plan2.operatorType);
123+
124+
if (!plan1.children || !plan2.children )
125+
{
126+
expect(plan1.children).toBeUndefined();
127+
expect(plan2.children).toBeUndefined();
128+
}
129+
else
130+
{
131+
expect(plan1.children).toBeDefined();
132+
expect(plan2.children).toBeDefined();
133+
134+
// recursively calling the same method to verify they are equal
135+
verifyPlansAreEqual(plan1.children, plan2.children);
136+
}
137+
}
68138
});

test/v1/tck/steps/environment.js

Lines changed: 0 additions & 100 deletions
This file was deleted.

0 commit comments

Comments
 (0)