@@ -290,6 +290,51 @@ describe('given a mock platform for a BrowserClient', () => {
290290 expect ( order ) . toEqual ( [ 'user-key-1' , 'user-key-3' ] ) ;
291291 } ) ;
292292
293+ it ( 'completes awaited identify calls in order without shedding' , async ( ) => {
294+ const order : string [ ] = [ ] ;
295+ const client = new BrowserClient (
296+ 'client-side-id' ,
297+ AutoEnvAttributes . Disabled ,
298+ {
299+ streaming : false ,
300+ logger,
301+ diagnosticOptOut : true ,
302+ sendEvents : false ,
303+ fetchGoals : false ,
304+ hooks : [
305+ {
306+ afterIdentify : ( hookContext , data , result ) => {
307+ if ( result . status === 'shed' ) {
308+ return data ;
309+ }
310+ if ( 'kind' in hookContext . context && hookContext . context . kind !== 'multi' ) {
311+ order . push ( ( hookContext . context as LDSingleKindContext ) . key ) ;
312+ }
313+
314+ return data ;
315+ } ,
316+ getMetadata : ( ) => ( {
317+ name : 'test-hook' ,
318+ version : '1.0.0' ,
319+ } ) ,
320+ } ,
321+ ] ,
322+ } ,
323+ platform ,
324+ ) ;
325+
326+ const result1 = await client . identifyResult ( { key : 'user-key-1' , kind : 'user' } ) ;
327+ const result2 = await client . identifyResult ( { key : 'user-key-2' , kind : 'user' } ) ;
328+ const result3 = await client . identifyResult ( { key : 'user-key-3' , kind : 'user' } ) ;
329+
330+ expect ( result1 . status ) . toEqual ( 'completed' ) ;
331+ expect ( result2 . status ) . toEqual ( 'completed' ) ;
332+ expect ( result3 . status ) . toEqual ( 'completed' ) ;
333+
334+ // user-key-2 is shed, so it is not included in the order
335+ expect ( order ) . toEqual ( [ 'user-key-1' , 'user-key-2' , 'user-key-3' ] ) ;
336+ } ) ;
337+
293338 it ( 'can shed intermediate identify calls' , async ( ) => {
294339 const client = new BrowserClient (
295340 'client-side-id' ,
0 commit comments