mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-10 04:36:43 +00:00
Other: Safer user types
This commit is contained in:
@ -51,7 +51,7 @@ func (t *testCtx) startBridge() error {
|
||||
}
|
||||
|
||||
// Create the bridge.
|
||||
bridge, err := bridge.New(
|
||||
bridge, eventCh, err := bridge.New(
|
||||
t.locator,
|
||||
vault,
|
||||
t.mocks.Autostarter,
|
||||
@ -73,6 +73,9 @@ func (t *testCtx) startBridge() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Wait for the users to be loaded.
|
||||
waitForEvent(eventCh, events.AllUsersLoaded{})
|
||||
|
||||
// Save the bridge t.
|
||||
t.bridge = bridge
|
||||
|
||||
@ -101,3 +104,12 @@ func (t *testCtx) stopBridge() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func waitForEvent[T any](eventCh <-chan events.Event, wantEvent T) {
|
||||
for event := range eventCh {
|
||||
switch event.(type) {
|
||||
case T:
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user