summaryrefslogtreecommitdiffstats
path: root/webapp/tests/client_preferences.test.jsx
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2016-07-19 10:16:44 -0400
committerGitHub <noreply@github.com>2016-07-19 10:16:44 -0400
commit1641370fbedc42e07f7a9b7758286d341f13b624 (patch)
tree0571746e175c7b6da2a5587bda1b8aaca033cc03 /webapp/tests/client_preferences.test.jsx
parent2b0fcd378ce96277f393b89cac1a98d70e1c480f (diff)
downloadchat-1641370fbedc42e07f7a9b7758286d341f13b624.tar.gz
chat-1641370fbedc42e07f7a9b7758286d341f13b624.tar.bz2
chat-1641370fbedc42e07f7a9b7758286d341f13b624.zip
Moving javascript driver back to platform (#3613)
Diffstat (limited to 'webapp/tests/client_preferences.test.jsx')
-rw-r--r--webapp/tests/client_preferences.test.jsx65
1 files changed, 65 insertions, 0 deletions
diff --git a/webapp/tests/client_preferences.test.jsx b/webapp/tests/client_preferences.test.jsx
new file mode 100644
index 000000000..95b026bfc
--- /dev/null
+++ b/webapp/tests/client_preferences.test.jsx
@@ -0,0 +1,65 @@
+// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+import assert from 'assert';
+import TestHelper from './test_helper.jsx';
+
+describe('Client.Preferences', function() {
+ this.timeout(100000);
+
+ it('getAllPreferences', function(done) {
+ TestHelper.initBasic(() => {
+ TestHelper.basicClient().getAllPreferences(
+ function(data) {
+ assert.equal(data[0].category, 'tutorial_step');
+ assert.equal(data[0].user_id, TestHelper.basicUser().id);
+ done();
+ },
+ function(err) {
+ done(new Error(err.message));
+ }
+ );
+ });
+ });
+
+ it('savePreferences', function(done) {
+ TestHelper.initBasic(() => {
+ 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) {
+ assert.equal(data, true);
+ done();
+ },
+ function(err) {
+ done(new Error(err.message));
+ }
+ );
+ });
+ });
+
+ it('getPreferenceCategory', function(done) {
+ TestHelper.initBasic(() => {
+ TestHelper.basicClient().getPreferenceCategory(
+ 'tutorial_step',
+ function(data) {
+ assert.equal(data[0].category, 'tutorial_step');
+ assert.equal(data[0].user_id, TestHelper.basicUser().id);
+ done();
+ },
+ function(err) {
+ done(new Error(err.message));
+ }
+ );
+ });
+ });
+});
+