MCPcopy
hub / github.com/parse-community/parse-server / reconfigureServer

Function reconfigureServer

spec/helper.js:190–224  ·  view source on GitHub ↗
(changedConfiguration = {})

Source from the content-addressed store, hash-verified

188
189// Allows testing specific configurations of Parse Server
190const reconfigureServer = async (changedConfiguration = {}) => {
191 if (parseServer) {
192 await shutdownServer(parseServer);
193 return reconfigureServer(changedConfiguration);
194 }
195 didChangeConfiguration = Object.keys(changedConfiguration).length !== 0;
196 databaseAdapter = new databaseAdapter.constructor({
197 uri: databaseURI,
198 collectionPrefix: 'test_',
199 });
200 defaultConfiguration.databaseAdapter = databaseAdapter;
201 global.databaseAdapter = databaseAdapter;
202 if (filesAdapter instanceof GridFSBucketAdapter) {
203 defaultConfiguration.filesAdapter = new GridFSBucketAdapter(mongoURI);
204 }
205 if (process.env.PARSE_SERVER_TEST_CACHE === 'redis') {
206 defaultConfiguration.cacheAdapter = new RedisCacheAdapter();
207 }
208 const newConfiguration = Object.assign({}, defaultConfiguration, changedConfiguration, {
209 mountPath: '/1',
210 port,
211 });
212 cache.clear();
213 parseServer = await ParseServer.startApp(newConfiguration);
214 Parse.CoreManager.setRESTController(RESTController);
215 parseServer.expressApp.use('/1', err => {
216 console.error(err);
217 fail('should not call next');
218 });
219 openConnections.track(parseServer.server);
220 if (parseServer.liveQueryServer?.server && parseServer.liveQueryServer.server !== parseServer.server) {
221 openConnections.track(parseServer.liveQueryServer.server);
222 }
223 return parseServer;
224};
225
226beforeAll(async () => {
227 global.restoreFetch();

Calls 6

shutdownServerFunction · 0.85
failFunction · 0.85
startAppMethod · 0.80
errorMethod · 0.80
trackMethod · 0.80
clearMethod · 0.45

Tested by 10

setupFunction · 0.68
execTestFunction · 0.68
setupFunction · 0.68
setupGraphQLFunction · 0.68
setupGraphQLServerFunction · 0.68
setupFunction · 0.68
expectErrorFunction · 0.68