File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,34 @@ describe('Queue', () => {
8787 expect ( await sub . next ( ) ) . to . deep . equal ( { done : false , value : [ 1 , 2 , 3 ] } ) ;
8888 } ) ;
8989
90+ it ( 'should ignore sync error in the executor' , async ( ) => {
91+ let push ! : ( item : number ) => void ;
92+ const queue = new Queue < number > ( ( _push ) => {
93+ push = _push ;
94+ throw new Error ( 'Oops' ) ;
95+ } ) ;
96+
97+ push ( 1 ) ;
98+
99+ const sub = queue . subscribe ( ( batch ) => Array . from ( batch ) ) ;
100+ expect ( await sub . next ( ) ) . to . deep . equal ( { done : false , value : [ 1 ] } ) ;
101+ } ) ;
102+
103+ it ( 'should ignore async error in the executor' , async ( ) => {
104+ let push ! : ( item : number ) => void ;
105+ const queue = new Queue < number > ( async ( _push ) => {
106+ push = _push ;
107+ await resolveOnNextTick ( ) ;
108+ throw new Error ( 'Oops' ) ;
109+ } ) ;
110+
111+ await resolveOnNextTick ( ) ;
112+ push ( 1 ) ;
113+
114+ const sub = queue . subscribe ( ( batch ) => Array . from ( batch ) ) ;
115+ expect ( await sub . next ( ) ) . to . deep . equal ( { done : false , value : [ 1 ] } ) ;
116+ } ) ;
117+
90118 it ( 'should skip payloads when mapped to undefined, skipping first async payload' , async ( ) => {
91119 const queue = new Queue < number > ( async ( push ) => {
92120 await resolveOnNextTick ( ) ;
You can’t perform that action at this time.
0 commit comments