Rewrite test to avoid connection spy
This commit is contained in:
parent
6253dd52a6
commit
445ff4f8aa
@ -79,20 +79,16 @@
|
|||||||
[`${Strophe.NS.PUBSUB}#publish-options`]
|
[`${Strophe.NS.PUBSUB}#publish-options`]
|
||||||
);
|
);
|
||||||
|
|
||||||
const call = await u.waitUntil(() =>
|
const IQ_stanzas = _converse.connection.IQ_stanzas;
|
||||||
_.filter(
|
const sent_stanza = await u.waitUntil(() => IQ_stanzas.filter(s => sizzle('items[node="storage:bookmarks"]', s).length).pop());
|
||||||
_converse.connection.send.calls.all(),
|
expect(Strophe.serialize(sent_stanza)).toBe(
|
||||||
c => sizzle('items[node="storage:bookmarks"]', c.args[0]).length
|
`<iq from="romeo@montague.lit/orchard" id="${sent_stanza.getAttribute('id')}" type="get" xmlns="jabber:client">`+
|
||||||
).pop()
|
|
||||||
);
|
|
||||||
expect(Strophe.serialize(call.args[0])).toBe(
|
|
||||||
`<iq from="romeo@montague.lit/orchard" id="${call.args[0].getAttribute('id')}" type="get" xmlns="jabber:client">`+
|
|
||||||
'<pubsub xmlns="http://jabber.org/protocol/pubsub">'+
|
'<pubsub xmlns="http://jabber.org/protocol/pubsub">'+
|
||||||
'<items node="storage:bookmarks"/>'+
|
'<items node="storage:bookmarks"/>'+
|
||||||
'</pubsub>'+
|
'</pubsub>'+
|
||||||
'</iq>');
|
'</iq>');
|
||||||
|
|
||||||
stanza = $iq({'to': _converse.connection.jid, 'type':'result', 'id':call.args[0].getAttribute('id')})
|
stanza = $iq({'to': _converse.connection.jid, 'type':'result', 'id':sent_stanza.getAttribute('id')})
|
||||||
.c('pubsub', {'xmlns': Strophe.NS.PUBSUB})
|
.c('pubsub', {'xmlns': Strophe.NS.PUBSUB})
|
||||||
.c('items', {'node': 'storage:bookmarks'})
|
.c('items', {'node': 'storage:bookmarks'})
|
||||||
.c('item', {'id': 'current'})
|
.c('item', {'id': 'current'})
|
||||||
|
Loading…
Reference in New Issue
Block a user