Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 15 additions & 36 deletions tests/msc2716_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ var (
markerInsertionContentField = "org.matrix.msc2716.marker.insertion"
)

var createRoomOpts = map[string]interface{}{
"preset": "public_chat",
"name": "the hangout spot",
"room_version": "org.matrix.msc2716",
}

func TestBackfillingHistory(t *testing.T) {
deployment := Deploy(t, b.BlueprintHSWithApplicationService)
defer deployment.Destroy(t)
Expand Down Expand Up @@ -75,10 +81,7 @@ func TestBackfillingHistory(t *testing.T) {
t.Run("Backfilled historical events resolve with proper state in correct order", func(t *testing.T) {
t.Parallel()

roomID := as.CreateRoom(t, map[string]interface{}{
"preset": "public_chat",
"name": "the hangout spot",
})
roomID := as.CreateRoom(t, createRoomOpts)
alice.JoinRoom(t, roomID, nil)

// Create some normal messages in the timeline. We're creating them in
Expand Down Expand Up @@ -189,10 +192,7 @@ func TestBackfillingHistory(t *testing.T) {
t.Run("Backfilled historical events from multiple users in the same chunk", func(t *testing.T) {
t.Parallel()

roomID := as.CreateRoom(t, map[string]interface{}{
"preset": "public_chat",
"name": "the hangout spot",
})
roomID := as.CreateRoom(t, createRoomOpts)
alice.JoinRoom(t, roomID, nil)

// Create the "live" event we are going to insert our backfilled events next to
Expand Down Expand Up @@ -239,10 +239,7 @@ func TestBackfillingHistory(t *testing.T) {
t.Run("Backfilled historical events with m.historical do not come down in an incremental sync", func(t *testing.T) {
t.Parallel()

roomID := as.CreateRoom(t, map[string]interface{}{
"preset": "public_chat",
"name": "the hangout spot",
})
roomID := as.CreateRoom(t, createRoomOpts)
alice.JoinRoom(t, roomID, nil)

// Create the "live" event we are going to insert our backfilled events next to
Expand Down Expand Up @@ -289,10 +286,7 @@ func TestBackfillingHistory(t *testing.T) {
t.Run("Unrecognised prev_event ID will throw an error", func(t *testing.T) {
t.Parallel()

roomID := as.CreateRoom(t, map[string]interface{}{
"preset": "public_chat",
"name": "the hangout spot",
})
roomID := as.CreateRoom(t, createRoomOpts)

batchSendHistoricalMessages(
t,
Expand All @@ -314,10 +308,7 @@ func TestBackfillingHistory(t *testing.T) {
t.Run("Normal users aren't allowed to backfill messages", func(t *testing.T) {
t.Parallel()

roomID := as.CreateRoom(t, map[string]interface{}{
"preset": "public_chat",
"name": "the hangout spot",
})
roomID := as.CreateRoom(t, createRoomOpts)
alice.JoinRoom(t, roomID, nil)

eventIDsBefore := createMessagesInRoom(t, alice, roomID, 1)
Expand Down Expand Up @@ -348,10 +339,7 @@ func TestBackfillingHistory(t *testing.T) {
t.Skip("Skipping until federation is implemented")
t.Parallel()

roomID := as.CreateRoom(t, map[string]interface{}{
"preset": "public_chat",
"name": "the hangout spot",
})
roomID := as.CreateRoom(t, createRoomOpts)
alice.JoinRoom(t, roomID, nil)

eventIDsBefore := createMessagesInRoom(t, alice, roomID, 1)
Expand Down Expand Up @@ -406,10 +394,7 @@ func TestBackfillingHistory(t *testing.T) {
t.Skip("Skipping until federation is implemented")
t.Parallel()

roomID := as.CreateRoom(t, map[string]interface{}{
"preset": "public_chat",
"name": "the hangout spot",
})
roomID := as.CreateRoom(t, createRoomOpts)
alice.JoinRoom(t, roomID, nil)

eventIDsBefore := createMessagesInRoom(t, alice, roomID, 1)
Expand Down Expand Up @@ -482,10 +467,7 @@ func TestBackfillingHistory(t *testing.T) {
t.Skip("Skipping until federation is implemented")
t.Parallel()

roomID := as.CreateRoom(t, map[string]interface{}{
"preset": "public_chat",
"name": "the hangout spot",
})
roomID := as.CreateRoom(t, createRoomOpts)
alice.JoinRoom(t, roomID, nil)

// Join the room from a remote homeserver before any backfilled messages are sent
Expand Down Expand Up @@ -589,10 +571,7 @@ func TestBackfillingHistory(t *testing.T) {
t.Skip("Skipping until federation is implemented")
t.Parallel()

roomID := as.CreateRoom(t, map[string]interface{}{
"preset": "public_chat",
"name": "the hangout spot",
})
roomID := as.CreateRoom(t, createRoomOpts)
alice.JoinRoom(t, roomID, nil)

// Join the room from a remote homeserver before any backfilled messages are sent
Expand Down