summaryrefslogtreecommitdiffstats
path: root/webapp/tests/client/client_preferences.test.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'webapp/tests/client/client_preferences.test.jsx')
-rw-r--r--webapp/tests/client/client_preferences.test.jsx62
1 files changed, 62 insertions, 0 deletions
diff --git a/webapp/tests/client/client_preferences.test.jsx b/webapp/tests/client/client_preferences.test.jsx
new file mode 100644
index 000000000..9a8f75b95
--- /dev/null
+++ b/webapp/tests/client/client_preferences.test.jsx
@@ -0,0 +1,62 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import TestHelper from 'tests/helpers/client-test-helper.jsx';
+
+describe('Client.Preferences', function() {
+ test('getAllPreferences', function(done) {
+ TestHelper.initBasic(done, () => {
+ TestHelper.basicClient().getAllPreferences(
+ function(data) {
+ expect(data[0].category).toBe('tutorial_step');
+ expect(data[0].user_id).toEqual(TestHelper.basicUser().id);
+ done();
+ },
+ function(err) {
+ done.fail(new Error(err.message));
+ }
+ );
+ });
+ });
+
+ test('savePreferences', function(done) {
+ TestHelper.initBasic(done, () => {
+ var perf = {};
+ perf.user_id = TestHelper.basicUser().id;
+ perf.category = 'test';
+ perf.name = 'name';
+ perf.value = 'value';
+
+ var perfs = [];
+ perfs.push(perf);
+
+ TestHelper.basicClient().savePreferences(
+ perfs,
+ function(data) {
+ expect(data).toBe(true);
+ done();
+ },
+ function(err) {
+ done.fail(new Error(err.message));
+ }
+ );
+ });
+ });
+
+ test('getPreferenceCategory', function(done) {
+ TestHelper.initBasic(done, () => {
+ TestHelper.basicClient().getPreferenceCategory(
+ 'tutorial_step',
+ function(data) {
+ expect(data[0].category).toBe('tutorial_step');
+ expect(data[0].user_id).toEqual(TestHelper.basicUser().id);
+ done();
+ },
+ function(err) {
+ done.fail(new Error(err.message));
+ }
+ );
+ });
+ });
+});
+