forked from parse-community/Parse-SDK-JS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ParseConfigTest.js
44 lines (34 loc) · 1.28 KB
/
ParseConfigTest.js
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
'use strict';
const assert = require('assert');
const Parse = require('../../node');
function testConfig() {
return Parse.Config.save({ internal: 'i', string: 's', number: 12 }, { internal: true });
}
describe('Parse Config', () => {
it('can create a config', async () => {
const config = await testConfig();
assert.notStrictEqual(config, undefined);
assert.strictEqual(config.get('string'), 's');
assert.strictEqual(config.get('internal'), 'i');
assert.strictEqual(config.get('number'), 12);
});
it('can get a config', async () => {
await testConfig();
const config = await Parse.Config.get();
assert.notStrictEqual(config, undefined);
assert.strictEqual(config.get('string'), 's');
assert.strictEqual(config.get('number'), 12);
});
it('can get internal config parameter with masterkey', async () => {
await testConfig();
const config = await Parse.Config.get({ useMasterKey: true });
assert.equal(config.get('internal'), 'i');
assert.equal(config.get('string'), 's');
});
it('cannot get internal config parameter without masterkey', async () => {
await testConfig();
const config = await Parse.Config.get();
assert.equal(config.get('internal'), undefined);
assert.equal(config.get('string'), 's');
});
});