@@ -33,20 +33,19 @@ describe("matrix qa e2ee client storage", () => {
3333 } ) ,
3434 shutdownTimeoutMs : options ?. shutdownTimeoutMs ?? 500 ,
3535 stopAndPersist : vi . fn ( async ( ) => {
36- calls . push ( "persist" ) ;
36+ calls . push ( "stop-and- persist" ) ;
3737 } ) ,
38- stopSyncWithoutPersist : vi . fn ( ( ) => calls . push ( "stop-sync" ) ) ,
39- stopWithoutPersist : vi . fn ( ( ) => calls . push ( "discard" ) ) ,
38+ stopWithoutPersist : vi . fn ( ( ) => calls . push ( "stop-and-discard" ) ) ,
4039 } ) ;
4140 return { calls, lifecycle } ;
4241 }
4342
44- it ( "stops sync, drains decryptions, and only then persists " , async ( ) => {
43+ it ( "drains decryptions before stopping the SDK and persisting " , async ( ) => {
4544 const { calls, lifecycle } = createLifecycleFixture ( ) ;
4645
4746 await lifecycle . stop ( ) ;
4847
49- expect ( calls ) . toEqual ( [ "detach" , "stop-sync" , " drain", "persist" ] ) ;
48+ expect ( calls ) . toEqual ( [ "detach" , "drain" , "stop-and- persist" ] ) ;
5049 } ) ;
5150
5251 it ( "shares one stop promise across concurrent and repeated shutdown requests" , async ( ) => {
@@ -68,10 +67,10 @@ describe("matrix qa e2ee client storage", () => {
6867 } ) ,
6968 ) . rejects . toThrow ( "shutdown has started" ) ;
7069 expect ( run ) . not . toHaveBeenCalled ( ) ;
71- expect ( calls ) . toEqual ( [ "detach" , "stop-sync" , " drain", "persist" ] ) ;
70+ expect ( calls ) . toEqual ( [ "detach" , "drain" , "stop-and- persist" ] ) ;
7271 } ) ;
7372
74- it ( "gives an active operation a bounded grace period before stopping sync " , async ( ) => {
73+ it ( "gives an active operation a bounded grace period before draining and stopping " , async ( ) => {
7574 vi . useFakeTimers ( ) ;
7675 try {
7776 const { calls, lifecycle } = createLifecycleFixture ( ) ;
@@ -92,7 +91,7 @@ describe("matrix qa e2ee client storage", () => {
9291 await operation ;
9392 await stop ;
9493
95- expect ( calls ) . toEqual ( [ "operation" , "detach" , "stop-sync" , " drain", "persist" ] ) ;
94+ expect ( calls ) . toEqual ( [ "operation" , "detach" , "drain" , "stop-and- persist" ] ) ;
9695 } finally {
9796 vi . useRealTimers ( ) ;
9897 }
@@ -120,7 +119,7 @@ describe("matrix qa e2ee client storage", () => {
120119 await vi . advanceTimersByTimeAsync ( 100 ) ;
121120
122121 await rejection ;
123- expect ( calls ) . toEqual ( [ "operation" , "detach" , "discard" ] ) ;
122+ expect ( calls ) . toEqual ( [ "operation" , "detach" , "stop-and- discard" ] ) ;
124123 } finally {
125124 vi . useRealTimers ( ) ;
126125 }
@@ -144,7 +143,7 @@ describe("matrix qa e2ee client storage", () => {
144143 await vi . advanceTimersByTimeAsync ( 100 ) ;
145144
146145 await rejection ;
147- expect ( calls ) . toEqual ( [ "detach" , "stop-sync" , " drain", "discard" ] ) ;
146+ expect ( calls ) . toEqual ( [ "detach" , "drain" , "stop-and- discard" ] ) ;
148147 } finally {
149148 vi . useRealTimers ( ) ;
150149 }
@@ -173,7 +172,7 @@ describe("matrix qa e2ee client storage", () => {
173172 await rejection ;
174173 expect ( calls ) . toEqual ( [ "operation" , "detach" ] ) ;
175174 await vi . advanceTimersByTimeAsync ( 100 ) ;
176- expect ( calls ) . toEqual ( [ "operation" , "detach" , "discard" ] ) ;
175+ expect ( calls ) . toEqual ( [ "operation" , "detach" , "stop-and- discard" ] ) ;
177176 } finally {
178177 vi . useRealTimers ( ) ;
179178 }
0 commit comments