Skip to content

Commit eed4734

Browse files
author
Zhen
committed
Add examples for driver documentation
1 parent d057222 commit eed4734

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/v1/examples.test.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,38 @@ describe('examples', () => {
107107
};
108108
});
109109

110+
it('config connection pool example', done => {
111+
// tag::config-connection-pool[]
112+
const driver = neo4j.driver(uri, neo4j.auth.basic(user, password),
113+
{
114+
maxConnectionLifetime: 30*60*60,
115+
maxConnectionPoolSize: 50,
116+
connectionAcquisitionTimeout: 2*60
117+
}
118+
);
119+
// end::config-connection-pool[]
120+
121+
driver.onCompleted = () => {
122+
driver.close();
123+
done();
124+
};
125+
});
126+
127+
it('config load balancing example', done => {
128+
// tag::config-load-balancing-strategy[]
129+
const driver = neo4j.driver(uri, neo4j.auth.basic(user, password),
130+
{
131+
loadBalancingStrategy: "least_connected"
132+
}
133+
);
134+
// end::config-load-balancing-strategy[]
135+
136+
driver.onCompleted = () => {
137+
driver.close();
138+
done();
139+
};
140+
});
141+
110142
it('config max retry time example', done => {
111143
// tag::config-max-retry-time[]
112144
const maxRetryTimeMs = 15 * 1000; // 15 seconds

0 commit comments

Comments
 (0)