-
-
Notifications
You must be signed in to change notification settings - Fork 777
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
67 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -443,4 +443,39 @@ describe("A bookmark", function () { | |
</pubsub> | ||
</iq>`); | ||
})); | ||
|
||
it("handles missing bookmarks gracefully when server responds with item-not-found", mock.initConverse( | ||
['chatBoxesFetched'], {}, async (_converse) => { | ||
|
||
await mock.waitForRoster(_converse, 'current', 0); | ||
await mock.waitUntilDiscoConfirmed( | ||
_converse, _converse.bare_jid, | ||
[{'category': 'pubsub', 'type': 'pep'}], | ||
['http://jabber.org/protocol/pubsub#publish-options', 'urn:xmpp:bookmarks:1#compat'] | ||
); | ||
|
||
const IQ_stanzas = _converse.api.connection.get().IQ_stanzas; | ||
const sent_stanza = await u.waitUntil( | ||
() => IQ_stanzas.filter(s => sizzle(`items[node="urn:xmpp:bookmarks:1"]`, s).length).pop()); | ||
|
||
// Simulate server response with item-not-found error | ||
const error_stanza = stx` | ||
<iq xmlns="jabber:client" type="error" | ||
id="${sent_stanza.getAttribute('id')}" | ||
from="${sent_stanza.getAttribute('to')}" | ||
to="${sent_stanza.getAttribute('from')}"> | ||
<pubsub xmlns="http://jabber.org/protocol/pubsub"> | ||
<items node="urn:xmpp:bookmarks:1"/> | ||
</pubsub> | ||
<error code="404" type="cancel"> | ||
<item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/> | ||
</error> | ||
</iq>`; | ||
_converse.api.connection.get()._dataRecv(mock.createRequest(error_stanza)); | ||
|
||
const cache_key = `[email protected]`; | ||
const result = await u.waitUntil(() => window.sessionStorage.getItem(cache_key)); | ||
expect(result).toBe('true'); | ||
}) | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters