@@ -382,62 +382,6 @@ describe("CameraKitProvider", () => {
382382 expect ( result . current . lenses ) . toHaveLength ( 2 ) ;
383383 } ) ;
384384
385- it ( "should clear lens cache on re-bootstrap" , async ( ) => {
386- const mockLens = { id : "lens-1" , groupId : "group-1" } as Lens ;
387- ( mockKit . lensRepository . loadLens as any ) . mockResolvedValue ( mockLens ) ;
388-
389- const mockKit2 = {
390- destroy : jest . fn ( ) . mockResolvedValue ( undefined ) ,
391- createSession : jest . fn ( ) . mockResolvedValue ( mockSession ) ,
392- lensRepository : {
393- loadLens : jest . fn ( ) . mockResolvedValue ( mockLens ) ,
394- loadLensGroups : jest . fn ( ) ,
395- } ,
396- } as any ;
397-
398- mockBootstrapCameraKit . mockReset ( ) . mockResolvedValueOnce ( mockKit ) . mockResolvedValueOnce ( mockKit2 ) ;
399-
400- let stabilityKey = "key-1" ;
401- const wrapper = ( { children } : { children : React . ReactNode } ) => (
402- < CameraKitProvider apiToken = "test-token" stabilityKey = { stabilityKey } >
403- { children }
404- </ CameraKitProvider >
405- ) ;
406-
407- const { result, rerender } = renderHook ( ( ) => useCameraKit ( ) , { wrapper } ) ;
408-
409- await waitFor ( ( ) => {
410- expect ( result . current . sdkStatus ) . toBe ( "ready" ) ;
411- } ) ;
412-
413- // Fetch a lens — populates the cache
414- await act ( async ( ) => {
415- await result . current . fetchLens ( "lens-1" , "group-1" ) ;
416- } ) ;
417-
418- expect ( mockKit . lensRepository . loadLens ) . toHaveBeenCalledTimes ( 1 ) ;
419- expect ( result . current . lenses ) . toHaveLength ( 1 ) ;
420-
421- // Trigger re-bootstrap by changing stabilityKey
422- stabilityKey = "key-2" ;
423- rerender ( ) ;
424-
425- await waitFor ( ( ) => {
426- expect ( result . current . sdkStatus ) . toBe ( "ready" ) ;
427- expect ( mockBootstrapCameraKit ) . toHaveBeenCalledTimes ( 2 ) ;
428- } ) ;
429-
430- // Lenses state should have been cleared
431- expect ( result . current . lenses ) . toHaveLength ( 0 ) ;
432-
433- // Fetch the same lens again — should NOT hit cache, should call new kit's loadLens
434- await act ( async ( ) => {
435- await result . current . fetchLens ( "lens-1" , "group-1" ) ;
436- } ) ;
437-
438- expect ( mockKit2 . lensRepository . loadLens ) . toHaveBeenCalledWith ( "lens-1" , "group-1" ) ;
439- } ) ;
440-
441385 it ( "should apply lens" , async ( ) => {
442386 const mockLens = { id : "lens-1" , groupId : "group-1" } as Lens ;
443387 ( mockKit . lensRepository . loadLens as any ) . mockResolvedValue ( mockLens ) ;
0 commit comments