summaryrefslogtreecommitdiffstats
path: root/js/tests/unit/service/SettingsResourceSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tests/unit/service/SettingsResourceSpec.js')
-rw-r--r--js/tests/unit/service/SettingsResourceSpec.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/js/tests/unit/service/SettingsResourceSpec.js b/js/tests/unit/service/SettingsResourceSpec.js
new file mode 100644
index 000000000..912e342d1
--- /dev/null
+++ b/js/tests/unit/service/SettingsResourceSpec.js
@@ -0,0 +1,50 @@
+/**
+ * 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('SettingsResource', () => {
+ 'use strict';
+
+ let http;
+
+ beforeEach(module('News', ($provide) => {
+ $provide.value('BASE_URL', 'base');
+ }));
+
+ beforeEach(inject(($httpBackend) => {
+ http = $httpBackend;
+ }));
+
+
+ it('should receive default SettingsResource', inject((SettingsResource) => {
+ SettingsResource.receive({
+ 'showAll': true
+ });
+
+ expect(SettingsResource.get('showAll')).toBe(true);
+ }));
+
+
+ it('should set values', inject((SettingsResource) => {
+ http.expectPOST('base/settings', {showAll: true}).respond(200, {});
+
+ SettingsResource.set('showAll', true);
+
+ http.flush();
+
+ expect(SettingsResource.get('showAll')).toBe(true);
+ }));
+
+
+ afterEach(() => {
+ http.verifyNoOutstandingExpectation();
+ http.verifyNoOutstandingRequest();
+ });
+
+
+}); \ No newline at end of file