2015-07-21 23:24:05 +02:00
|
|
|
(function (root, factory) {
|
|
|
|
define([
|
|
|
|
"jquery",
|
2016-11-30 13:18:58 +01:00
|
|
|
"converse-api",
|
2015-07-21 23:24:05 +02:00
|
|
|
"mock",
|
2016-11-30 13:18:58 +01:00
|
|
|
"test_utils"], factory);
|
|
|
|
} (this, function ($, converse_api, mock, test_utils) {
|
2015-07-21 23:24:05 +02:00
|
|
|
"use strict";
|
|
|
|
var Strophe = converse_api.env.Strophe;
|
|
|
|
|
2016-11-03 11:01:09 +01:00
|
|
|
describe("Service Discovery", function () {
|
2015-07-21 23:24:05 +02:00
|
|
|
|
2016-11-03 11:01:09 +01:00
|
|
|
describe("Whenever converse.js discovers a new server feature", function () {
|
|
|
|
afterEach(function () {
|
|
|
|
converse_api.user.logout();
|
|
|
|
converse_api.listen.not();
|
|
|
|
test_utils.clearBrowserStorage();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("emits the serviceDiscovered event", mock.initConverse(function (converse) {
|
2015-07-21 23:24:05 +02:00
|
|
|
spyOn(converse, 'emit');
|
|
|
|
converse.features.create({'var': Strophe.NS.MAM});
|
|
|
|
expect(converse.emit).toHaveBeenCalled();
|
|
|
|
expect(converse.emit.argsForCall[0][1].get('var')).toBe(Strophe.NS.MAM);
|
2016-11-03 11:01:09 +01:00
|
|
|
}));
|
|
|
|
});
|
|
|
|
});
|
2015-07-21 23:24:05 +02:00
|
|
|
}));
|