Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
e6723063
Commit
e6723063
authored
May 07, 2020
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for muc_send_probe setting
parent
3319398f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
0 deletions
+46
-0
spec/muc.js
spec/muc.js
+46
-0
No files found.
spec/muc.js
View file @
e6723063
...
...
@@ -5292,4 +5292,50 @@ describe("Groupchats", function () {
done
();
}));
});
describe
(
"
when muc_send_probes is true
"
,
function
()
{
it
(
"
sends presence probes when muc_send_probes is true
"
,
mock
.
initConverse
(
[
'
rosterGroupsFetched
'
],
{
'
muc_send_probes
'
:
true
},
async
function
(
done
,
_converse
)
{
const
muc_jid
=
'
lounge@montague.lit
'
;
await
mock
.
openAndEnterChatRoom
(
_converse
,
muc_jid
,
'
romeo
'
);
const
stanza
=
u
.
toStanza
(
`
<message xmlns="jabber:client" to="
${
_converse
.
jid
}
" type="groupchat" from="
${
muc_jid
}
/ralphm">
<body>This message will trigger a presence probe</body>
</message>`
);
_converse
.
connection
.
_dataRecv
(
mock
.
createRequest
(
stanza
));
const
view
=
_converse
.
chatboxviews
.
get
(
muc_jid
);
await
u
.
waitUntil
(()
=>
view
.
model
.
messages
.
length
);
const
occupant
=
view
.
model
.
messages
.
at
(
0
)?.
occupant
;
expect
(
occupant
).
toBeDefined
();
expect
(
occupant
.
get
(
'
nick
'
)).
toBe
(
'
ralphm
'
);
expect
(
occupant
.
get
(
'
affiliation
'
)).
toBeUndefined
();
expect
(
occupant
.
get
(
'
role
'
)).
toBeUndefined
();
const
sent_stanzas
=
_converse
.
connection
.
sent_stanzas
;
const
probe
=
await
u
.
waitUntil
(()
=>
sent_stanzas
.
filter
(
s
=>
s
.
matches
(
'
presence[type="probe"]
'
)).
pop
());
expect
(
Strophe
.
serialize
(
probe
)).
toBe
(
`<presence to="
${
muc_jid
}
/ralphm" type="probe" xmlns="jabber:client">`
+
`<priority>0</priority>`
+
`<c hash="sha-1" node="https://conversejs.org" ver="Hxbsr5fazs62i+O0GxIXf2OEDNs=" xmlns="http://jabber.org/protocol/caps"/>`
+
`</presence>`
);
const
presence
=
u
.
toStanza
(
`<presence xmlns="jabber:client" to="
${
converse
.
jid
}
" from="
${
muc_jid
}
/ralphm">
<x xmlns="http://jabber.org/protocol/muc#user">
<item affiliation="member" jid="ralph@example.org/Conversations.ZvLu" role="participant"/>
</x>
</presence>`
);
_converse
.
connection
.
_dataRecv
(
mock
.
createRequest
(
presence
));
expect
(
occupant
.
get
(
'
affiliation
'
)).
toBe
(
'
member
'
);
expect
(
occupant
.
get
(
'
role
'
)).
toBe
(
'
participant
'
);
done
();
}));
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment