Skip to content

Commit 1cc610a

Browse files
committed
stress-test:Fix check if the ssl scheme is set in the url
1 parent 43ced00 commit 1cc610a

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

packages/neo4j-driver/test/stress-test.js

+4-13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* limitations under the License.
1818
*/
1919

20+
import { internal } from 'neo4j-driver-core'
2021
import neo4j from '../src'
2122
import { READ, WRITE } from '../src/driver'
2223
import parallelLimit from 'async/parallelLimit'
@@ -137,19 +138,9 @@ function isRemoteCluster () {
137138
return fromEnvOrDefault('STRESS_TEST_DATABASE_URI') !== undefined
138139
}
139140

140-
function isSslSchemeNotSet (uri) {
141-
function extractScheme (scheme) {
142-
if (scheme) {
143-
scheme = scheme.trim()
144-
if (scheme.charAt(scheme.length - 1) === ':') {
145-
scheme = scheme.substring(0, scheme.length - 1)
146-
}
147-
return scheme
148-
}
149-
return null
150-
}
151-
const scheme = extractScheme(uri)
152-
return scheme === null || scheme === 'bolt' || scheme === 'neo4j'
141+
function isSslSchemeNotSet (url) {
142+
const parsedUri = internal.urlUtil.parseDatabaseUrl(url)
143+
return parsedUri.scheme === null || parsedUri.scheme === 'bolt' || parsedUri.scheme === 'neo4j'
153144
}
154145

155146
function isCluster () {

0 commit comments

Comments
 (0)