cozy-labs / cozy-desktop

File Synchronisation for Cozy on Desktop and Laptop
https://cozy-labs.github.io/cozy-desktop/
GNU Affero General Public License v3.0
98 stars 45 forks source link

fix: Use Sync lifecycle state transitions in tests #2292

Closed taratatach closed 1 year ago

taratatach commented 1 year ago

We use the Sync lifecycle module to follow state changes and take actions upon them. This is done via async methods which return Promises resolving when a specific state is transitioned to.

However, in tests, we were modifying the state by hand so the associated events would not be fired and the Promises waiting for them would never resolve. This resulted in tests failing from time to time, especially in the Windows and macOS CI builds.

We replaced all the manual state changes with the appropriate transitions.

Please make sure the following boxes are checked: