* Adds flow types / Configuration interfaces * Lets call it options * Use a single interface to generate the configurations * Translates options to definitions only if comments are set * improves logic * Moves objects around * Fixes issue affecting logging of circular objects * fixes undefined env * Moves all defaults to defaults * Adds back CLI defaults * Restored defaults in commander.js * Merge provided defaults and platform defaults * Addresses visual nits * Improves Config.js code * Adds ability to pass the default value in trailing comments * Load platform defaults from the definitions file * proper default values on various options * Adds ParseServer.start and server.start(options) as quick startup methods * Moves creating liveQueryServer http into ParseServer.js * removes dead code * Adds tests to guarantee we can start a LQ Server from main module * Fixes incorrect code regading liveQuery init port * Start a http server for LQ if port is specified * ensure we dont fail if config.port is not set * Specify port * ignore other path skipped in tests * Adds test for custom middleware setting * Refactors new Config into Config.get - Hides AppCache from ParseServer.js, use Config.put which validates * Extracts controller creation into Controllers/index.js - This makes the ParseServer init way simpler * Move serverURL inference into ParseServer * review nits
50 lines
1.5 KiB
JavaScript
50 lines
1.5 KiB
JavaScript
const auth = require('../src/Auth');
|
|
const Config = require('../src/Config');
|
|
const rest = require('../src/rest');
|
|
|
|
describe('Enable single schema cache', () => {
|
|
beforeEach((done) => {
|
|
reconfigureServer({
|
|
enableSingleSchemaCache: true,
|
|
schemaCacheTTL: 30000
|
|
}).then(() => {
|
|
done();
|
|
});
|
|
});
|
|
|
|
it('can perform multiple create and query operations', (done) => {
|
|
let config = fakeRequestForConfig();
|
|
let nobody = auth.nobody(config);
|
|
rest.create(config, nobody, 'Foo', {type: 1}).then(() => {
|
|
config = fakeRequestForConfig();
|
|
nobody = auth.nobody(config);
|
|
return rest.create(config, nobody, 'Foo', {type: 2});
|
|
}).then(() => {
|
|
config = fakeRequestForConfig();
|
|
nobody = auth.nobody(config);
|
|
return rest.create(config, nobody, 'Bar');
|
|
}).then(() => {
|
|
config = fakeRequestForConfig();
|
|
nobody = auth.nobody(config);
|
|
return rest.find(config, nobody, 'Bar', {type: 1});
|
|
}).then(() => {
|
|
fail('Should throw error');
|
|
done();
|
|
}, (error) => {
|
|
config = fakeRequestForConfig();
|
|
nobody = auth.nobody(config);
|
|
expect(error).toBeDefined();
|
|
return rest.find(config, nobody, 'Foo', {type: 1});
|
|
}).then((response) => {
|
|
config = fakeRequestForConfig();
|
|
nobody = auth.nobody(config);
|
|
expect(response.results.length).toEqual(1);
|
|
done();
|
|
});
|
|
});
|
|
});
|
|
|
|
const fakeRequestForConfig = function() {
|
|
return Config.get('test');
|
|
};
|