-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconnector_test.go
More file actions
47 lines (41 loc) · 1.39 KB
/
connector_test.go
File metadata and controls
47 lines (41 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package dummybridge
import (
"testing"
"maunium.net/go/mautrix/bridgev2"
"maunium.net/go/mautrix/bridgev2/database"
"maunium.net/go/mautrix/event"
)
func TestFillPortalBridgeInfoSetsAIRoomType(t *testing.T) {
conn := NewConnector()
portal := &bridgev2.Portal{Portal: &database.Portal{RoomType: database.RoomTypeDM}}
content := &event.BridgeEventContent{}
conn.FillPortalBridgeInfo(portal, content)
if content.BeeperRoomTypeV2 != "dm" {
t.Fatalf("expected dm room type, got %q", content.BeeperRoomTypeV2)
}
if content.Protocol.ID != "ai-dummybridge" {
t.Fatalf("expected ai-dummybridge protocol, got %q", content.Protocol.ID)
}
}
func TestGetCapabilitiesExposeProvisioningSearchAndContacts(t *testing.T) {
conn := NewConnector()
caps := conn.GetCapabilities()
if caps == nil {
t.Fatal("expected capabilities")
}
if !caps.Provisioning.ResolveIdentifier.CreateDM {
t.Fatal("expected create DM provisioning to be enabled")
}
if !caps.Provisioning.ResolveIdentifier.ContactList {
t.Fatal("expected contact list provisioning to be enabled")
}
if !caps.Provisioning.ResolveIdentifier.Search {
t.Fatal("expected search provisioning to be enabled")
}
}
func TestGetNameUsesDefaultCommandPrefixBeforeStartup(t *testing.T) {
conn := NewConnector()
if got := conn.GetName().DefaultCommandPrefix; got != "!dummybridge" {
t.Fatalf("expected default command prefix !dummybridge, got %q", got)
}
}