1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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));
}
);
});
});
});
|