summaryrefslogtreecommitdiffstats
path: root/js/tests/unit/service/PublisherSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tests/unit/service/PublisherSpec.js')
-rw-r--r--js/tests/unit/service/PublisherSpec.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/js/tests/unit/service/PublisherSpec.js b/js/tests/unit/service/PublisherSpec.js
new file mode 100644
index 000000000..8a019f0db
--- /dev/null
+++ b/js/tests/unit/service/PublisherSpec.js
@@ -0,0 +1,26 @@
+/**
+ * ownCloud - News
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later. See the COPYING file.
+ *
+ * @author Bernhard Posselt <dev@bernhard-posselt.com>
+ * @copyright Bernhard Posselt 2014
+ */
+describe('Publisher', function () {
+ 'use strict';
+
+ beforeEach(module('News'));
+
+ it('should subscribe an object and publish a message', inject(function (Publisher) {
+ var obj = {
+ receive: jasmine.createSpy('receive')
+ };
+ Publisher.subscribe(obj).toChannel('test');
+
+ Publisher.publish('tom').onChannel('test');
+ expect(obj.receive).toHaveBeenCalledWith('tom');
+ }));
+
+
+}); \ No newline at end of file