From ea965766b4cac0fc9e4df7babe2347cfcf850b9b Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Mon, 23 Apr 2018 00:04:10 +0300 Subject: Gofmt and enable a test --- matrix/rooms/room.go | 2 +- matrix/rooms/room_test.go | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'matrix') diff --git a/matrix/rooms/room.go b/matrix/rooms/room.go index c10a2fd..99c9a66 100644 --- a/matrix/rooms/room.go +++ b/matrix/rooms/room.go @@ -27,7 +27,7 @@ import ( type RoomNameSource int const ( - ExplicitRoomName RoomNameSource = iota + ExplicitRoomName RoomNameSource = iota CanonicalAliasRoomName AliasRoomName MemberRoomName diff --git a/matrix/rooms/room_test.go b/matrix/rooms/room_test.go index 2f3f402..40624e1 100644 --- a/matrix/rooms/room_test.go +++ b/matrix/rooms/room_test.go @@ -26,7 +26,6 @@ import ( ) func TestNewRoom_DefaultValues(t *testing.T) { - /* room := rooms.NewRoom("!test:maunium.net", "@tulir:maunium.net") assert.Equal(t, "!test:maunium.net", room.ID) assert.Equal(t, "@tulir:maunium.net", room.SessionUserID) @@ -36,7 +35,6 @@ func TestNewRoom_DefaultValues(t *testing.T) { assert.Empty(t, room.GetCanonicalAlias()) assert.Empty(t, room.GetTopic()) assert.Nil(t, room.GetSessionOwner()) - */ } func TestRoom_GetCanonicalAlias(t *testing.T) { @@ -61,7 +59,6 @@ func TestRoom_GetTopic(t *testing.T) { assert.Equal(t, "test topic", room.GetTopic()) } - func TestRoom_GetAliases(t *testing.T) { room := rooms.NewRoom("!test:maunium.net", "@tulir:maunium.net") addAliases(room) @@ -94,7 +91,7 @@ func addCanonicalAlias(room *rooms.Room) { func addAliases(room *rooms.Room) { server1 := "maunium.net" room.UpdateState(&gomatrix.Event{ - Type: "m.room.aliases", + Type: "m.room.aliases", StateKey: &server1, Content: map[string]interface{}{ "aliases": []interface{}{"#bar:maunium.net", "#test:maunium.net", "#foo:maunium.net"}, @@ -103,7 +100,7 @@ func addAliases(room *rooms.Room) { server2 := "matrix.org" room.UpdateState(&gomatrix.Event{ - Type: "m.room.aliases", + Type: "m.room.aliases", StateKey: &server2, Content: map[string]interface{}{ "aliases": []interface{}{"#foo:matrix.org", "#test:matrix.org"}, @@ -114,11 +111,11 @@ func addAliases(room *rooms.Room) { func addMembers(room *rooms.Room, count int) { user1 := "@tulir:maunium.net" room.UpdateState(&gomatrix.Event{ - Type: "m.room.member", + Type: "m.room.member", StateKey: &user1, Content: map[string]interface{}{ "displayname": "tulir", - "membership": "join", + "membership": "join", }, }) @@ -127,16 +124,16 @@ func addMembers(room *rooms.Room, count int) { content := map[string]interface{}{ "membership": "join", } - if i % 2 == 1 { + if i%2 == 1 { content["displayname"] = fmt.Sprintf("User #%d", i+1) } - if i % 5 == 0 { + if i%5 == 0 { content["membership"] = "invite" } room.UpdateState(&gomatrix.Event{ - Type: "m.room.member", + Type: "m.room.member", StateKey: &userN, - Content: content, + Content: content, }) } } -- cgit v1.2.3