@@ -19,27 +19,27 @@ describeWithMongoDB("Connection Manager", (integration) => {
19
19
await connectionManager ( ) . disconnect ( ) ;
20
20
// for testing, force disconnecting AND setting the connection to closed to reset the
21
21
// state of the connection manager
22
- connectionManager ( ) . changeState ( "connection-closed " , { tag : "disconnected" } ) ;
22
+ connectionManager ( ) . changeState ( "connection-close " , { tag : "disconnected" } ) ;
23
23
} ) ;
24
24
25
25
describe ( "when successfully connected" , ( ) => {
26
26
type ConnectionManagerSpies = {
27
- "connection-requested " : ( event : ConnectionManagerEvents [ "connection-requested " ] [ 0 ] ) => void ;
28
- "connection-succeeded " : ( event : ConnectionManagerEvents [ "connection-succeeded " ] [ 0 ] ) => void ;
29
- "connection-timed -out" : ( event : ConnectionManagerEvents [ "connection-timed -out" ] [ 0 ] ) => void ;
30
- "connection-closed " : ( event : ConnectionManagerEvents [ "connection-closed " ] [ 0 ] ) => void ;
31
- "connection-errored " : ( event : ConnectionManagerEvents [ "connection-errored " ] [ 0 ] ) => void ;
27
+ "connection-request " : ( event : ConnectionManagerEvents [ "connection-request " ] [ 0 ] ) => void ;
28
+ "connection-success " : ( event : ConnectionManagerEvents [ "connection-succeess " ] [ 0 ] ) => void ;
29
+ "connection-time -out" : ( event : ConnectionManagerEvents [ "connection-time -out" ] [ 0 ] ) => void ;
30
+ "connection-close " : ( event : ConnectionManagerEvents [ "connection-close " ] [ 0 ] ) => void ;
31
+ "connection-error " : ( event : ConnectionManagerEvents [ "connection-error " ] [ 0 ] ) => void ;
32
32
} ;
33
33
34
34
let connectionManagerSpies : ConnectionManagerSpies ;
35
35
36
36
beforeEach ( async ( ) => {
37
37
connectionManagerSpies = {
38
- "connection-requested " : vi . fn ( ) ,
39
- "connection-succeeded " : vi . fn ( ) ,
40
- "connection-timed -out" : vi . fn ( ) ,
41
- "connection-closed " : vi . fn ( ) ,
42
- "connection-errored " : vi . fn ( ) ,
38
+ "connection-request " : vi . fn ( ) ,
39
+ "connection-success " : vi . fn ( ) ,
40
+ "connection-time -out" : vi . fn ( ) ,
41
+ "connection-close " : vi . fn ( ) ,
42
+ "connection-error " : vi . fn ( ) ,
43
43
} ;
44
44
45
45
for ( const [ event , spy ] of Object . entries ( connectionManagerSpies ) ) {
@@ -62,11 +62,11 @@ describeWithMongoDB("Connection Manager", (integration) => {
62
62
} ) ;
63
63
64
64
it ( "should notify that the connection was requested" , ( ) => {
65
- expect ( connectionManagerSpies [ "connection-requested " ] ) . toHaveBeenCalledOnce ( ) ;
65
+ expect ( connectionManagerSpies [ "connection-request " ] ) . toHaveBeenCalledOnce ( ) ;
66
66
} ) ;
67
67
68
68
it ( "should notify that the connection was successful" , ( ) => {
69
- expect ( connectionManagerSpies [ "connection-succeeded " ] ) . toHaveBeenCalledOnce ( ) ;
69
+ expect ( connectionManagerSpies [ "connection-success " ] ) . toHaveBeenCalledOnce ( ) ;
70
70
} ) ;
71
71
72
72
describe ( "when disconnects" , ( ) => {
@@ -75,7 +75,7 @@ describeWithMongoDB("Connection Manager", (integration) => {
75
75
} ) ;
76
76
77
77
it ( "should notify that it was disconnected before connecting" , ( ) => {
78
- expect ( connectionManagerSpies [ "connection-closed " ] ) . toHaveBeenCalled ( ) ;
78
+ expect ( connectionManagerSpies [ "connection-close " ] ) . toHaveBeenCalled ( ) ;
79
79
} ) ;
80
80
81
81
it ( "should be marked explicitly as disconnected" , ( ) => {
@@ -91,11 +91,11 @@ describeWithMongoDB("Connection Manager", (integration) => {
91
91
} ) ;
92
92
93
93
it ( "should notify that it was disconnected before connecting" , ( ) => {
94
- expect ( connectionManagerSpies [ "connection-closed " ] ) . toHaveBeenCalled ( ) ;
94
+ expect ( connectionManagerSpies [ "connection-close " ] ) . toHaveBeenCalled ( ) ;
95
95
} ) ;
96
96
97
97
it ( "should notify that it was connected again" , ( ) => {
98
- expect ( connectionManagerSpies [ "connection-succeeded " ] ) . toHaveBeenCalled ( ) ;
98
+ expect ( connectionManagerSpies [ "connection-success " ] ) . toHaveBeenCalled ( ) ;
99
99
} ) ;
100
100
101
101
it ( "should be marked explicitly as connected" , ( ) => {
@@ -115,11 +115,11 @@ describeWithMongoDB("Connection Manager", (integration) => {
115
115
} ) ;
116
116
117
117
it ( "should notify that it was disconnected before connecting" , ( ) => {
118
- expect ( connectionManagerSpies [ "connection-closed " ] ) . toHaveBeenCalled ( ) ;
118
+ expect ( connectionManagerSpies [ "connection-close " ] ) . toHaveBeenCalled ( ) ;
119
119
} ) ;
120
120
121
121
it ( "should notify that it failed connecting" , ( ) => {
122
- expect ( connectionManagerSpies [ "connection-errored " ] ) . toHaveBeenCalledWith ( {
122
+ expect ( connectionManagerSpies [ "connection-error " ] ) . toHaveBeenCalledWith ( {
123
123
tag : "errored" ,
124
124
connectedAtlasCluster : undefined ,
125
125
connectionStringAuthType : "scram" ,
@@ -152,11 +152,11 @@ describeWithMongoDB("Connection Manager", (integration) => {
152
152
} ) ;
153
153
154
154
it ( "should notify that it was disconnected before connecting" , ( ) => {
155
- expect ( connectionManagerSpies [ "connection-closed " ] ) . toHaveBeenCalled ( ) ;
155
+ expect ( connectionManagerSpies [ "connection-close " ] ) . toHaveBeenCalled ( ) ;
156
156
} ) ;
157
157
158
158
it ( "should notify that it failed connecting" , ( ) => {
159
- expect ( connectionManagerSpies [ "connection-errored " ] ) . toHaveBeenCalledWith ( {
159
+ expect ( connectionManagerSpies [ "connection-error " ] ) . toHaveBeenCalledWith ( {
160
160
tag : "errored" ,
161
161
connectedAtlasCluster : atlas ,
162
162
connectionStringAuthType : "scram" ,
0 commit comments