@@ -112,7 +112,7 @@ describe("MatrixScheduler", function () {
112
112
expect ( procCount ) . toEqual ( 2 ) ;
113
113
} ) ;
114
114
115
- it ( "should give up if the retryFn on failure returns -1 and try the next event " , async function ( ) {
115
+ it ( "should give up if the retryFn on failure returns -1" , async function ( ) {
116
116
// Queue A & B.
117
117
// Reject A and return -1 on retry.
118
118
// Expect B to be tried next and the promise for A to be rejected.
@@ -139,19 +139,15 @@ describe("MatrixScheduler", function () {
139
139
return new Promise < Record < string , boolean > > ( ( ) => { } ) ;
140
140
} ) ;
141
141
142
- const globalA = scheduler . queueEvent ( eventA ) ;
143
- scheduler . queueEvent ( eventB ) ;
142
+ const queuedA = scheduler . queueEvent ( eventA ) ;
143
+ const queuedB = scheduler . queueEvent ( eventB ) ;
144
+ await Promise . resolve ( ) ;
145
+ deferA . reject ( new Error ( "Testerror" ) ) ;
144
146
// as queueing doesn't start processing synchronously anymore (see commit bbdb5ac)
145
147
// wait just long enough before it does
146
- await Promise . resolve ( ) ;
148
+ await expect ( queuedA ) . rejects . toThrow ( "Testerror" ) ;
149
+ await expect ( queuedB ) . rejects . toThrow ( "Testerror" ) ;
147
150
expect ( procCount ) . toEqual ( 1 ) ;
148
- deferA . reject ( { } ) ;
149
- try {
150
- await globalA ;
151
- } catch ( err ) {
152
- await Promise . resolve ( ) ;
153
- expect ( procCount ) . toEqual ( 2 ) ;
154
- }
155
151
} ) ;
156
152
157
153
it ( "should treat each queue separately" , function ( done ) {
0 commit comments