File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed
packages/shared/sdk-client/__tests__/async Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change 11import { AsyncTaskQueue } from '../../src/async/AsyncTaskQueue' ;
22
3- it . each ( [ true , false ] ) ( 'executes the initial task it is given: sheddable: %s' , async ( sheddable ) => {
4- const queue = new AsyncTaskQueue < string > ( ) ;
5- const task = jest . fn ( ) . mockResolvedValue ( 'test' ) ;
6- const result = await queue . execute ( task , sheddable ) ;
7- expect ( queue . pendingCount ( ) ) . toBe ( 0 ) ;
8- expect ( result ) . toEqual ( {
9- status : 'complete' ,
10- result : 'test' ,
11- } ) ;
12- expect ( task ) . toHaveBeenCalled ( ) ;
13- } ) ;
3+ it . each ( [ true , false ] ) (
4+ 'executes the initial task it is given: sheddable: %s' ,
5+ async ( sheddable ) => {
6+ const queue = new AsyncTaskQueue < string > ( ) ;
7+ const task = jest . fn ( ) . mockResolvedValue ( 'test' ) ;
8+ const result = await queue . execute ( task , sheddable ) ;
9+ expect ( queue . pendingCount ( ) ) . toBe ( 0 ) ;
10+ expect ( result ) . toEqual ( {
11+ status : 'complete' ,
12+ result : 'test' ,
13+ } ) ;
14+ expect ( task ) . toHaveBeenCalled ( ) ;
15+ } ,
16+ ) ;
1417
1518it . each ( [ true , false ] ) (
1619 'executes the next task in the queue when the previous task completes: sheddable: %s' ,
You can’t perform that action at this time.
0 commit comments