@@ -27,58 +27,77 @@ const scheme = env.TEST_NEO4J_SCHEME || 'bolt'
27
27
const boltPort = env . TEST_NEO4J_BOLT_PORT || 7687
28
28
const uri = `${ scheme } ://${ hostname } :${ boltPort } `
29
29
const authToken = neo4j . auth . basic ( username , password )
30
+ const testContainersDisabled = env . TEST_CONTAINERS_DISABLED !== undefined
31
+ ? env . TEST_CONTAINERS_DISABLED . toUpperCase ( ) === 'TRUE'
32
+ : false
30
33
31
34
// Deno will fail with resource leaks
32
- Deno . test ( 'neo4j.driver should be able to use explicity resource management' , async ( ) => {
33
- await using driver = neo4j . driver ( uri , authToken )
35
+ Deno . test ( {
36
+ name : 'neo4j.driver should be able to use explicity resource management' ,
37
+ ignore : ! testContainersDisabled ,
38
+ async fn ( ) {
39
+ await using driver = neo4j . driver ( uri , authToken )
34
40
35
- await driver . executeQuery ( 'RETURN 1' )
36
- } )
37
-
38
- // Deno will fail with resource leaks
39
- Deno . test ( 'driver.session should be able to use explicity resource management' , async ( ) => {
40
- await using driver = neo4j . driver ( uri , authToken )
41
- await using session = driver . session ( )
42
-
43
- await session . executeRead ( tx => "RETURN 1" )
41
+ await driver . executeQuery ( 'RETURN 1' )
42
+ }
44
43
} )
45
44
46
-
47
45
// Deno will fail with resource leaks
48
- Deno . test ( 'session.beginTransaction should rollback the transaction if not committed' , async ( ) => {
49
- await using driver = neo4j . driver ( uri , authToken )
50
- await using session = driver . session ( )
51
- const name = "Must Be Conor"
46
+ Deno . test ( {
47
+ name : 'driver.session should be able to use explicity resource management' ,
48
+ ignore : ! testContainersDisabled ,
49
+ async fn ( ) {
50
+ await using driver = neo4j . driver ( uri , authToken )
51
+ await using session = driver . session ( )
52
52
53
+ await session . executeRead ( tx => "RETURN 1" )
53
54
54
- {
55
- await using tx = session . beginTransaction ( )
56
- await tx . run ( 'CREATE (p:Person { name:$name }) RETURN p' , { name } ) . summary ( )
57
55
}
58
-
59
- const { records } = await driver . executeQuery ( 'MATCH (p:Person { name:$name }) RETURN p' , { name } )
60
- assertEquals ( records . length , 0 )
61
56
} )
62
57
63
-
64
58
// Deno will fail with resource leaks
65
- Deno . test ( 'session.beginTransaction should noop if resource committed' , async ( ) => {
66
- await using driver = neo4j . driver ( uri , authToken )
67
- const name = "Must Be Conor"
68
-
69
- try {
59
+ Deno . test ( {
60
+ name : 'session.beginTransaction should rollback the transaction if not committed' ,
61
+ ignore : ! testContainersDisabled ,
62
+ async fn ( ) {
63
+ await using driver = neo4j . driver ( uri , authToken )
70
64
await using session = driver . session ( )
71
-
65
+ const name = "Must Be Conor"
66
+
72
67
{
73
68
await using tx = session . beginTransaction ( )
74
69
await tx . run ( 'CREATE (p:Person { name:$name }) RETURN p' , { name } ) . summary ( )
75
- await tx . commit ( )
76
70
}
77
-
71
+
78
72
const { records } = await driver . executeQuery ( 'MATCH (p:Person { name:$name }) RETURN p' , { name } )
79
- assertEquals ( records . length , 1 )
80
- } finally {
81
- // cleaning up
82
- await driver . executeQuery ( 'MATCH (p:Person { name:$name }) DELETE(p)' , { name } )
73
+ assertEquals ( records . length , 0 )
74
+ }
75
+ } )
76
+
77
+
78
+ // Deno will fail with resource leaks
79
+ Deno . test ( {
80
+ name : 'session.beginTransaction should noop if resource committed' ,
81
+ ignore : ! testContainersDisabled ,
82
+ async fn ( ) {
83
+ await using driver = neo4j . driver ( uri , authToken )
84
+ const name = "Must Be Conor"
85
+
86
+ try {
87
+ await using session = driver . session ( )
88
+
89
+ {
90
+ await using tx = session . beginTransaction ( )
91
+ await tx . run ( 'CREATE (p:Person { name:$name }) RETURN p' , { name } ) . summary ( )
92
+ await tx . commit ( )
93
+ }
94
+
95
+ const { records } = await driver . executeQuery ( 'MATCH (p:Person { name:$name }) RETURN p' , { name } )
96
+ assertEquals ( records . length , 1 )
97
+ } finally {
98
+ // cleaning up
99
+ await driver . executeQuery ( 'MATCH (p:Person { name:$name }) DELETE(p)' , { name } )
100
+ }
101
+
83
102
}
84
103
} )
0 commit comments