diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-19 02:22:02 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-19 02:22:02 +0200 |
commit | 90584316b8f275fcad904b644676544eb0322636 (patch) | |
tree | 35ead28e8f0cdccc1771464442bb83ce5b558cc6 /js/tests/unit | |
parent | ded252d29e99e068ea341506129e47a05e053a24 (diff) |
add test for firstrun page
Diffstat (limited to 'js/tests/unit')
-rw-r--r-- | js/tests/unit/controller/AppControllerSpec.js | 45 | ||||
-rw-r--r-- | js/tests/unit/service/LoadingSpec.js | 1 | ||||
-rw-r--r-- | js/tests/unit/service/PublisherSpec.js | 6 | ||||
-rw-r--r-- | js/tests/unit/service/SettingsSpec.js | 30 |
4 files changed, 82 insertions, 0 deletions
diff --git a/js/tests/unit/controller/AppControllerSpec.js b/js/tests/unit/controller/AppControllerSpec.js new file mode 100644 index 000000000..b7dad7492 --- /dev/null +++ b/js/tests/unit/controller/AppControllerSpec.js @@ -0,0 +1,45 @@ +/** + * 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('AppController', function () { + 'use strict'; + + var controller; + + beforeEach(module('News')); + + beforeEach(inject(function ($controller) { + controller = $controller('AppController'); + })); + + + it('should expose Loading', inject(function (Loading) { + expect(controller.loading).toBe(Loading); + })); + + + it('should expose set firstrun if no feeds and folders', inject(function () { + expect(controller.isFirstRun()).toBe(true); + })); + + + it('should expose set firstrun if feeds', inject(function (Feed) { + Feed.add({url: 'test'}); + + expect(controller.isFirstRun()).toBe(false); + })); + + + it('should expose set firstrun if folders', inject(function (Folder) { + Folder.add({name: 'test'}); + + expect(controller.isFirstRun()).toBe(false); + })); + +});
\ No newline at end of file diff --git a/js/tests/unit/service/LoadingSpec.js b/js/tests/unit/service/LoadingSpec.js index f8146b87f..2033f33cc 100644 --- a/js/tests/unit/service/LoadingSpec.js +++ b/js/tests/unit/service/LoadingSpec.js @@ -15,6 +15,7 @@ describe('Loading', function () { it('should be not load by default', inject(function (Loading) { expect(Loading.isLoading('global')).toBe(false); expect(Loading.isLoading('content')).toBe(false); + expect(Loading.isLoading('autopaging')).toBe(false); })); it('should set loading', inject(function (Loading) { diff --git a/js/tests/unit/service/PublisherSpec.js b/js/tests/unit/service/PublisherSpec.js index f7fa67796..2b9206c93 100644 --- a/js/tests/unit/service/PublisherSpec.js +++ b/js/tests/unit/service/PublisherSpec.js @@ -24,7 +24,13 @@ describe('Publisher', function () { }); expect(obj.receive).toHaveBeenCalledWith('tom'); + })); + + it('should not broadcast to not subscribed channels', inject(function (Publisher) { + Publisher.publishAll({ + test: 'tom' + }); })); });
\ No newline at end of file diff --git a/js/tests/unit/service/SettingsSpec.js b/js/tests/unit/service/SettingsSpec.js new file mode 100644 index 000000000..65dc4bf2f --- /dev/null +++ b/js/tests/unit/service/SettingsSpec.js @@ -0,0 +1,30 @@ +/** + * 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('Settings', function () { + 'use strict'; + + beforeEach(module('News')); + + it('should receive default settings', inject(function (Settings) { + Settings.receive({ + 'showAll': true + }); + + expect(Settings.get('showAll')).toBe(true); + })); + + + it('should set values', inject(function (Settings) { + Settings.set('showAll', true); + + expect(Settings.get('showAll')).toBe(true); + })); + +});
\ No newline at end of file |