Other: Safer user types

This commit is contained in:
James Houlahan
2022-10-12 00:20:04 +02:00
parent 4dc32dc7f2
commit fd63611b41
35 changed files with 1253 additions and 771 deletions

View File

@ -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
}
}
}