Skip to content

Commit

Permalink
Accept extra route handlers in createTestServer
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Quah committed Sep 23, 2022
1 parent 83ff595 commit 4eb69d6
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions tests/federation_room_join_partial_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,23 @@ import (

func TestPartialStateJoin(t *testing.T) {
// createTestServer spins up a federation server suitable for the tests in this file
createTestServer := func(t *testing.T, deployment *docker.Deployment) *federation.Server {
createTestServer := func(t *testing.T, deployment *docker.Deployment, opts ...func(*federation.Server)) *federation.Server {
t.Helper()

return federation.NewServer(t, deployment,
federation.HandleKeyRequests(),
federation.HandlePartialStateMakeSendJoinRequests(),
federation.HandleEventRequests(),
federation.HandleTransactionRequests(
func(e *gomatrixserverlib.Event) {
t.Fatalf("Received unexpected PDU: %s", string(e.JSON()))
},
// the homeserver under test may send us presence when the joining user syncs
nil,
),
append(
opts, // `opts` goes first so that it can override any of the following handlers
federation.HandleKeyRequests(),
federation.HandlePartialStateMakeSendJoinRequests(),
federation.HandleEventRequests(),
federation.HandleTransactionRequests(
func(e *gomatrixserverlib.Event) {
t.Fatalf("Received unexpected PDU: %s", string(e.JSON()))
},
// the homeserver under test may send us presence when the joining user syncs
nil,
),
)...,
)
}

Expand Down

0 comments on commit 4eb69d6

Please sign in to comment.