Implement ExtraPublicRoomsProvider for p2p demos (#1180)

* Change API and rename to ExtraPublicRoomsProvider

* Make dendritejs work again

* Maybe make libp2p demo work again

* Linting
This commit is contained in:
Kegsay 2020-07-03 12:59:00 +01:00 committed by GitHub
parent 1773fd84b7
commit 6c4b8185d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 433 additions and 250 deletions

View file

@ -3,16 +3,26 @@ package routing
import (
"reflect"
"testing"
"github.com/matrix-org/gomatrixserverlib"
)
func pubRoom(name string) gomatrixserverlib.PublicRoom {
return gomatrixserverlib.PublicRoom{
Name: name,
}
}
func TestSliceInto(t *testing.T) {
slice := []string{"a", "b", "c", "d", "e", "f", "g"}
slice := []gomatrixserverlib.PublicRoom{
pubRoom("a"), pubRoom("b"), pubRoom("c"), pubRoom("d"), pubRoom("e"), pubRoom("f"), pubRoom("g"),
}
limit := int16(3)
testCases := []struct {
since int64
wantPrev int
wantNext int
wantSubset []string
wantSubset []gomatrixserverlib.PublicRoom
}{
{
since: 0,