@@ -167,6 +167,17 @@ func TestInboxNotification_Watch(t *testing.T) {
167
167
168
168
dispatchFunc (ctx , uuid .New ())
169
169
170
+ _ , message , err := wsConn .Read (ctx )
171
+ require .NoError (t , err )
172
+
173
+ var notif codersdk.GetInboxNotificationResponse
174
+ err = json .Unmarshal (message , & notif )
175
+ require .NoError (t , err )
176
+
177
+ require .Equal (t , 1 , notif .UnreadCount )
178
+ require .Equal (t , memberClient .ID , notif .Notification .UserID )
179
+ require .Equal (t , "memory related title" , notif .Notification .Title )
180
+
170
181
dispatchFunc , err = inboxHandler .Dispatcher (types.MessagePayload {
171
182
UserID : memberClient .ID .String (),
172
183
NotificationTemplateID : notifications .TemplateWorkspaceOutOfDisk .String (),
@@ -183,17 +194,6 @@ func TestInboxNotification_Watch(t *testing.T) {
183
194
184
195
dispatchFunc (ctx , uuid .New ())
185
196
186
- _ , message , err := wsConn .Read (ctx )
187
- require .NoError (t , err )
188
-
189
- var notif codersdk.GetInboxNotificationResponse
190
- err = json .Unmarshal (message , & notif )
191
- require .NoError (t , err )
192
-
193
- require .Equal (t , 3 , notif .UnreadCount )
194
- require .Equal (t , memberClient .ID , notif .Notification .UserID )
195
- require .Equal (t , "memory related title" , notif .Notification .Title )
196
-
197
197
_ , message , err = wsConn .Read (ctx )
198
198
require .NoError (t , err )
199
199
@@ -249,6 +249,17 @@ func TestInboxNotification_Watch(t *testing.T) {
249
249
250
250
dispatchFunc (ctx , uuid .New ())
251
251
252
+ _ , message , err := wsConn .Read (ctx )
253
+ require .NoError (t , err )
254
+
255
+ var notif codersdk.GetInboxNotificationResponse
256
+ err = json .Unmarshal (message , & notif )
257
+ require .NoError (t , err )
258
+
259
+ require .Equal (t , 1 , notif .UnreadCount )
260
+ require .Equal (t , memberClient .ID , notif .Notification .UserID )
261
+ require .Equal (t , "memory related title" , notif .Notification .Title )
262
+
252
263
dispatchFunc , err = inboxHandler .Dispatcher (types.MessagePayload {
253
264
UserID : memberClient .ID .String (),
254
265
NotificationTemplateID : notifications .TemplateWorkspaceOutOfMemory .String (),
@@ -267,17 +278,6 @@ func TestInboxNotification_Watch(t *testing.T) {
267
278
268
279
dispatchFunc (ctx , uuid .New ())
269
280
270
- _ , message , err := wsConn .Read (ctx )
271
- require .NoError (t , err )
272
-
273
- var notif codersdk.GetInboxNotificationResponse
274
- err = json .Unmarshal (message , & notif )
275
- require .NoError (t , err )
276
-
277
- require .Equal (t , 3 , notif .UnreadCount )
278
- require .Equal (t , memberClient .ID , notif .Notification .UserID )
279
- require .Equal (t , "memory related title" , notif .Notification .Title )
280
-
281
281
_ , message , err = wsConn .Read (ctx )
282
282
require .NoError (t , err )
283
283
0 commit comments