@@ -15,6 +15,8 @@ afterEach(() => {
15
15
16
16
describe ( 'toHaveReceivedCommand' , ( ) => {
17
17
it ( 'passes on receiving Command' , async ( ) => {
18
+ expect . assertions ( 2 ) ;
19
+
18
20
const sns = new SNSClient ( { } ) ;
19
21
await sns . send ( publishCmd1 ) ;
20
22
@@ -29,6 +31,8 @@ SNSClient received <green>"PublishCommand"</color> <red>0</color> times"
29
31
} ) ;
30
32
31
33
it ( 'fails on receiving Command with not' , async ( ) => {
34
+ expect . assertions ( 2 ) ;
35
+
32
36
const sns = new SNSClient ( { } ) ;
33
37
await sns . send ( publishCmd1 ) ;
34
38
42
46
} ) ;
43
47
44
48
it ( 'fails on more arguments' , async ( ) => {
49
+ // We only expect 1 assertion here due to expected "internal error" in toHaveReceivedCommand
50
+ expect . assertions ( 1 ) ;
51
+
45
52
const sns = new SNSClient ( { } ) ;
46
53
await sns . send ( publishCmd1 ) ;
47
54
53
60
54
61
describe ( 'toHaveReceivedCommandTimes' , ( ) => {
55
62
it ( 'passes on receiving Command twice' , async ( ) => {
63
+ expect . assertions ( 2 ) ;
64
+
56
65
const sns = new SNSClient ( { } ) ;
57
66
await sns . send ( publishCmd1 ) ;
58
67
await sns . send ( publishCmd2 ) ;
74
83
} ) ;
75
84
76
85
it ( 'fails on receiving Command twice with not' , async ( ) => {
86
+ expect . assertions ( 2 ) ;
87
+
77
88
const sns = new SNSClient ( { } ) ;
78
89
await sns . send ( publishCmd1 ) ;
79
90
await sns . send ( publishCmd1 ) ;
@@ -91,6 +102,8 @@ Calls:
91
102
92
103
describe ( 'toHaveReceivedCommandWith' , ( ) => {
93
104
it ( 'passes on receiving Command with partial match' , async ( ) => {
105
+ expect . assertions ( 2 ) ;
106
+
94
107
const sns = new SNSClient ( { } ) ;
95
108
await sns . send ( publishCmd1 ) ;
96
109
await sns . send ( publishCmd2 ) ;
@@ -99,6 +112,8 @@ describe('toHaveReceivedCommandWith', () => {
99
112
} ) ;
100
113
101
114
it ( 'fails on not receiving Command' , async ( ) => {
115
+ expect . assertions ( 2 ) ;
116
+
102
117
const sns = new SNSClient ( { } ) ;
103
118
await sns . send ( publishCmd1 ) ;
104
119
@@ -112,6 +127,8 @@ Calls:
112
127
} ) ;
113
128
114
129
it ( 'fails on receiving Command with partial match with not' , async ( ) => {
130
+ expect . assertions ( 2 ) ;
131
+
115
132
const sns = new SNSClient ( { } ) ;
116
133
await sns . send ( publishCmd1 ) ;
117
134
@@ -125,6 +142,8 @@ Calls:
125
142
} ) ;
126
143
127
144
it ( 'passes on match with asymmetric matcher' , async ( ) => {
145
+ expect . assertions ( 2 ) ;
146
+
128
147
const sns = new SNSClient ( { } ) ;
129
148
await sns . send ( publishCmd1 ) ;
130
149
@@ -134,6 +153,8 @@ Calls:
134
153
} ) ;
135
154
136
155
it ( 'fails on unmatch with asymmetric matcher' , async ( ) => {
156
+ expect . assertions ( 2 ) ;
157
+
137
158
const sns = new SNSClient ( { } ) ;
138
159
await sns . send ( publishCmd1 ) ;
139
160
@@ -151,6 +172,8 @@ Calls:
151
172
152
173
describe ( 'toHaveReceivedNthCommandWith' , ( ) => {
153
174
it ( 'passes on receiving second Command with partial match' , async ( ) => {
175
+ expect . assertions ( 2 ) ;
176
+
154
177
const sns = new SNSClient ( { } ) ;
155
178
await sns . send ( publishCmd1 ) ;
156
179
await sns . send ( publishCmd2 ) ;
@@ -159,6 +182,8 @@ describe('toHaveReceivedNthCommandWith', () => {
159
182
} ) ;
160
183
161
184
it ( 'fails on not receiving second Command' , async ( ) => {
185
+ expect . assertions ( 2 ) ;
186
+
162
187
const sns = new SNSClient ( { } ) ;
163
188
await sns . send ( publishCmd1 ) ;
164
189
await sns . send ( publishCmd1 ) ;
@@ -182,6 +207,8 @@ Calls:
182
207
} ) ;
183
208
184
209
it ( 'fails on receiving second Command with not' , async ( ) => {
210
+ expect . assertions ( 2 ) ;
211
+
185
212
const sns = new SNSClient ( { } ) ;
186
213
await sns . send ( publishCmd1 ) ;
187
214
await sns . send ( publishCmd2 ) ;
@@ -204,6 +231,8 @@ Calls:
204
231
} ) ;
205
232
206
233
it ( 'fails on receiving less Commands than the nth requested' , async ( ) => {
234
+ expect . assertions ( 2 ) ;
235
+
207
236
const sns = new SNSClient ( { } ) ;
208
237
await sns . send ( publishCmd1 ) ;
209
238
@@ -216,6 +245,8 @@ Calls:
216
245
} ) ;
217
246
218
247
it ( 'passes on match with asymmetric matcher' , async ( ) => {
248
+ expect . assertions ( 2 ) ;
249
+
219
250
const sns = new SNSClient ( { } ) ;
220
251
await sns . send ( publishCmd1 ) ;
221
252
await sns . send ( publishCmd2 ) ;
@@ -226,6 +257,8 @@ Calls:
226
257
} ) ;
227
258
228
259
it ( 'fails on unmatch with asymmetric matcher' , async ( ) => {
260
+ expect . assertions ( 2 ) ;
261
+
229
262
const sns = new SNSClient ( { } ) ;
230
263
await sns . send ( publishCmd1 ) ;
231
264
await sns . send ( publishCmd2 ) ;
@@ -253,6 +286,8 @@ Calls:
253
286
254
287
describe ( 'toHaveReceivedNthSpecificCommandWith' , ( ) => {
255
288
it ( 'passes on receiving second Command with partial match' , async ( ) => {
289
+ expect . assertions ( 2 ) ;
290
+
256
291
const sns = new SNSClient ( { } ) ;
257
292
await sns . send ( publishCmd1 ) ;
258
293
await sns . send ( subscribeCmd1 ) ;
@@ -262,6 +297,8 @@ describe('toHaveReceivedNthSpecificCommandWith', () => {
262
297
} ) ;
263
298
264
299
it ( 'fails on receiving less Commands than the nth expected' , async ( ) => {
300
+ expect . assertions ( 2 ) ;
301
+
265
302
const sns = new SNSClient ( { } ) ;
266
303
await sns . send ( publishCmd1 ) ;
267
304
@@ -280,13 +317,16 @@ describe('toHaveReceivedAnyCommand', () => {
280
317
${ publishCmd1 }
281
318
${ subscribeCmd1 }
282
319
` ( 'passes on receiving any command' , async ( { command } : { command : AwsCommand < any , any > } ) => {
320
+ expect . assertions ( 2 ) ;
321
+
283
322
const sns = new SNSClient ( { } ) ;
284
323
await sns . send ( command ) ; // eslint-disable-line @typescript-eslint/no-unsafe-argument
285
324
286
325
expect ( ( ) => expect ( snsMock ) . toHaveReceivedAnyCommand ( ) ) . not . toThrow ( ) ;
287
326
} ) ;
288
327
289
328
it ( 'fails on not receiving any command' , ( ) => {
329
+ expect . assertions ( 2 ) ;
290
330
expect ( ( ) => expect ( snsMock ) . toHaveReceivedAnyCommand ( ) ) . toThrowErrorMatchingInlineSnapshot ( `
291
331
"Expected SNSClient to receive any command
292
332
SNSClient received any command <red>0</color> times"
0 commit comments