(t *testing.T)
| 33 | } |
| 34 | |
| 35 | func TestKeyChanges(t *testing.T) { |
| 36 | test.WithAllDatabases(t, func(t *testing.T, dbType test.DBType) { |
| 37 | db, clean := MustCreateDatabase(t, dbType) |
| 38 | defer clean() |
| 39 | _, err := db.StoreKeyChange(ctx, "@alice:localhost") |
| 40 | MustNotError(t, err) |
| 41 | deviceChangeIDB, err := db.StoreKeyChange(ctx, "@bob:localhost") |
| 42 | MustNotError(t, err) |
| 43 | deviceChangeIDC, err := db.StoreKeyChange(ctx, "@charlie:localhost") |
| 44 | MustNotError(t, err) |
| 45 | userIDs, latest, err := db.KeyChanges(ctx, deviceChangeIDB, types.OffsetNewest) |
| 46 | if err != nil { |
| 47 | t.Fatalf("Failed to KeyChanges: %s", err) |
| 48 | } |
| 49 | if latest != deviceChangeIDC { |
| 50 | t.Fatalf("KeyChanges: got latest=%d want %d", latest, deviceChangeIDC) |
| 51 | } |
| 52 | if !reflect.DeepEqual(userIDs, []string{"@charlie:localhost"}) { |
| 53 | t.Fatalf("KeyChanges: wrong user_ids: %v", userIDs) |
| 54 | } |
| 55 | }) |
| 56 | } |
| 57 | |
| 58 | func TestKeyChangesNoDupes(t *testing.T) { |
| 59 | test.WithAllDatabases(t, func(t *testing.T, dbType test.DBType) { |
nothing calls this directly
no test coverage detected