@@ -52,6 +52,7 @@ isolated function testSubscriptionMultiplexing() returns error? {
52
52
json expectedPayload = {'type : common :WS_NEXT , id : subscriptionId , payload : payload };
53
53
test : assertEquals (actualPayload , expectedPayload );
54
54
}
55
+ common : closeWebsocketClient (wsClient );
55
56
}
56
57
57
58
@test :Config {
@@ -66,6 +67,7 @@ isolated function testInvalidWebSocketRequestWithEmptyQuery() returns error? {
66
67
check common : sendSubscriptionMessage (wsClient , document );
67
68
json expectedMsgPayload = {errors : [{message : " An empty query is found" }]};
68
69
check common : validateErrorMessage (wsClient , expectedMsgPayload );
70
+ common : closeWebsocketClient (wsClient );
69
71
}
70
72
71
73
@test :Config {
@@ -80,7 +82,8 @@ isolated function testInvalidWebSocketRequestWithInvalidQuery() returns error? {
80
82
check wsClient -> writeMessage ({" type" : common :WS_SUBSCRIBE , id : " 1" , payload : payload });
81
83
string expectedErrorMsg = " Invalid format: payload does not conform to the format required by the" +
82
84
" 'graphql-transport-ws' subprotocol: Status code: 1003" ;
83
- common : validateConnectionClousureWithError (wsClient , expectedErrorMsg );
85
+ common : validateConnectionClosureWithError (wsClient , expectedErrorMsg );
86
+ common : closeWebsocketClient (wsClient );
84
87
}
85
88
86
89
@test :Config {
@@ -94,7 +97,8 @@ isolated function testInvalidWebSocketRequestWithoutQuery() returns error? {
94
97
check wsClient -> writeMessage ({" type" : common :WS_SUBSCRIBE , id : " 1" , payload : {}});
95
98
string expectedErrorMsg = " Invalid format: payload does not conform to the format required by the" +
96
99
" 'graphql-transport-ws' subprotocol: Status code: 1003" ;
97
- common : validateConnectionClousureWithError (wsClient , expectedErrorMsg );
100
+ common : validateConnectionClosureWithError (wsClient , expectedErrorMsg );
101
+ common : closeWebsocketClient (wsClient );
98
102
}
99
103
100
104
@test :Config {
@@ -110,7 +114,8 @@ isolated function testInvalidVariableInWebSocketPayload() returns error? {
110
114
check common : sendSubscriptionMessage (wsClient , document , variables = variables );
111
115
string expectedErrorMsg = " Invalid format: payload does not conform to the format required by the" +
112
116
" 'graphql-transport-ws' subprotocol: Status code: 1003" ;
113
- common : validateConnectionClousureWithError (wsClient , expectedErrorMsg );
117
+ common : validateConnectionClosureWithError (wsClient , expectedErrorMsg );
118
+ common : closeWebsocketClient (wsClient );
114
119
}
115
120
116
121
@test :Config {
@@ -124,7 +129,8 @@ isolated function testEmptyWebSocketPayload() returns error? {
124
129
check wsClient -> writeMessage (payload );
125
130
string expectedErrorMsg = " Invalid format: payload does not conform to the format required by the" +
126
131
" 'graphql-transport-ws' subprotocol: Status code: 1003" ;
127
- common : validateConnectionClousureWithError (wsClient , expectedErrorMsg );
132
+ common : validateConnectionClosureWithError (wsClient , expectedErrorMsg );
133
+ common : closeWebsocketClient (wsClient );
128
134
}
129
135
130
136
@test :Config {
@@ -137,5 +143,6 @@ isolated function testInvalidWebSocketPayload() returns error? {
137
143
check wsClient -> writeMessage (payload );
138
144
string expectedErrorMsg = " Invalid format: payload does not conform to the format required by the"
139
145
+ " 'graphql-transport-ws' subprotocol: Status code: 1003" ;
140
- common : validateConnectionClousureWithError (wsClient , expectedErrorMsg );
146
+ common : validateConnectionClosureWithError (wsClient , expectedErrorMsg );
147
+ common : closeWebsocketClient (wsClient );
141
148
}
0 commit comments