3IOKATFCBG7RT6BNZ2NBTUR244VWLGSNIJKQNOUPSMX7IPSSEJPQC
fn test_invite_by() {
config := setup.Config{}
m := init(config)
if json_str := os.read_file('src/matrix/invite_room.json') {
matrix_invite := json2.raw_decode(json_str) or {panic('')}.as_map()
assert m.invite_by(matrix_invite) == '#roomy-room:donp.org'
} else {
assert false
}
if json_str := os.read_file('src/matrix/invite_pm.json') {
matrix_invite := json2.raw_decode(json_str) or {panic('')}.as_map()
assert m.invite_by(matrix_invite) == '@donp:donp.org'
} else {
assert false
}
}
{"age":327,"content":{"displayname":"vbridge","membership":"invite"},"event_id":"$kCnvCzfP6BO-e_F5E9pefx-oTUJfvp2qyqA-_NShNng","invite_room_state":[{"content":{"avatar_url":"mxc:\/\/donp.org\/xWRPSLhFwLUjvaetqzSvPjnp","displayname":"donpdonp","membership":"join"},"sender":"@donp:donp.org","state_key":"@donp:donp.org","type":"m.room.member"},{"content":{"name":"Roomy Room"},"sender":"@donp:donp.org","state_key":"","type":"m.room.name"},{"content":{"alias":"#roomy-room:donp.org"},"sender":"@donp:donp.org","state_key":"","type":"m.room.canonical_alias"},{"content":{"url":"mxc:\/\/donp.org\/BkANcfXDSZklItkKGneDlqvF"},"sender":"@donp:donp.org","state_key":"","type":"m.room.avatar"},{"content":{"join_rule":"public"},"sender":"@donp:donp.org","state_key":"","type":"m.room.join_rules"}],"origin_server_ts":1615489245736,"prev_content":{"membership":"leave"},"replaces_state":"$Sdft63-MLYUjIBKjEAjeEDabj4Osn7WDHr4uA1RLMtY","room_id":"!FMIqCsoGJDbtjiBptb:donp.org","sender":"@donp:donp.org","state_key":"@vbridge:donp.org","type":"m.room.member","unsigned":{"age":327,"invite_room_state":[{"content":{"avatar_url":"mxc:\/\/donp.org\/xWRPSLhFwLUjvaetqzSvPjnp","displayname":"donpdonp","membership":"join"},"sender":"@donp:donp.org","state_key":"@donp:donp.org","type":"m.room.member"},{"content":{"name":"Roomy Room"},"sender":"@donp:donp.org","state_key":"","type":"m.room.name"},{"content":{"alias":"#roomy-room:donp.org"},"sender":"@donp:donp.org","state_key":"","type":"m.room.canonical_alias"},{"content":{"url":"mxc:\/\/donp.org\/BkANcfXDSZklItkKGneDlqvF"},"sender":"@donp:donp.org","state_key":"","type":"m.room.avatar"},{"content":{"join_rule":"public"},"sender":"@donp:donp.org","state_key":"","type":"m.room.join_rules"}],"prev_content":{"membership":"leave"},"prev_sender":"@vbridge:donp.org","replaces_state":"$Sdft63-MLYUjIBKjEAjeEDabj4Osn7WDHr4uA1RLMtY"},"user_id":"@donp:donp.org"}
{
"age": 378,
"content": {
"displayname": "vbridge",
"membership": "invite"
},
"event_id": "$z8O_L9KUgSghwnHVs1E7npXF32uUQD92mP7WXXKw06s",
"invite_room_state": [
{
"content": {
"avatar_url": "mxc://donp.org/xWRPSLhFwLU jvaetqzSvPjnp",
"displayname": "donpdonp",
"membership": "join"
},
"sender": "@donp:donp.org",
"state_key": "@donp:donp.org",
"type": "m.room.member"
},
{
"content": {
"join_rule": "invite"
},
"sender": "@donp:donp.org",
"state_key": " ",
"type": "m.room.join_rules"
}
],
"origin_server_ts": 1615489138691,
"room_id": "!RbtjkPtlKiEdaNkjkl:donp.org",
"sender": "@donp:donp.org",
"state_key": "@vbridge:donp.org",
"type": "m.room.member",
"unsigned": {
"age": 378,
"invi te_room_state": [
{
"content": {
"avatar_url": "mxc://donp.org/xWRPSLhFwLUjvaetqzSvPjnp",
"displayname": "donpdonp",
"membership": "join"
},
"sender": "@donp:donp.org",
"state_key": "@donp:donp.org",
"type": "m.room.member"
},
{
" content": {
"join_rule": "invite"
},
"sender": "@donp:donp.org",
"state_key": "",
"type": "m.room.join_rules"
}
]
},
"user_id": "@donp:donp.org"
}
module irc
fn test_parse_ping() {
irc_msg := 'PING ircbob'
parts := parse(irc_msg)
assert parts.len == 2
}
fn test_parse_251() {
irc_msg := ':oragono.test 251 ircvbridge :There are 0 users and 1 invisible on 1 server(s)'
parts := parse(irc_msg)
assert parts.len == 6
}
fn test_is_room() {
ircm := setup()
assert ircm.is_room('#room')
assert ircm.is_room('#roomy-room:donp.org') == false
}