forked from parse-community/Parse-SDK-JS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParseConfigTest.js
57 lines (46 loc) · 1.55 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
45
46
47
48
49
50
51
52
53
54
55
56
57
'use strict';
const assert = require('assert');
const clear = require('./clear');
const Parse = require('../../node');
function testConfig() {
return Parse.Config.save(
{ internal: "i", string: "s", number: 12 },
{ internal: true }
);
}
describe('Parse Config', () => {
beforeEach((done) => {
Parse.initialize('integration', null, 'notsosecret');
Parse.CoreManager.set('SERVER_URL', 'http://localhost:1337/parse');
Parse.Storage._clear();
clear().then(() => {
done();
});
});
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');
});
});