Remove test delays (#5579)
* Changing __indexBuildCompletionCallbackForTests callback to serverStartComplete * Improving serverStartComplete callback to avoid production unhandled promise rejection * Add test to check inexistence of unhandled promise rejection on server fail * Removing some hooks delays * Removing delay after reconfigureServer * Improving code style
This commit is contained in:
committed by
GitHub
parent
2f161c25cd
commit
893f1d376e
@@ -295,30 +295,28 @@ describe('server', () => {
|
||||
appId: 'aTestApp',
|
||||
masterKey: 'aTestMasterKey',
|
||||
serverURL: 'http://localhost:12666/parse',
|
||||
__indexBuildCompletionCallbackForTests: promise => {
|
||||
promise.then(() => {
|
||||
expect(Parse.applicationId).toEqual('aTestApp');
|
||||
const app = express();
|
||||
app.use('/parse', parseServer.app);
|
||||
serverStartComplete: () => {
|
||||
expect(Parse.applicationId).toEqual('aTestApp');
|
||||
const app = express();
|
||||
app.use('/parse', parseServer.app);
|
||||
|
||||
const server = app.listen(12666);
|
||||
const obj = new Parse.Object('AnObject');
|
||||
let objId;
|
||||
obj
|
||||
.save()
|
||||
.then(obj => {
|
||||
objId = obj.id;
|
||||
const q = new Parse.Query('AnObject');
|
||||
return q.first();
|
||||
})
|
||||
.then(obj => {
|
||||
expect(obj.id).toEqual(objId);
|
||||
server.close(done);
|
||||
})
|
||||
.catch(() => {
|
||||
server.close(done);
|
||||
});
|
||||
});
|
||||
const server = app.listen(12666);
|
||||
const obj = new Parse.Object('AnObject');
|
||||
let objId;
|
||||
obj
|
||||
.save()
|
||||
.then(obj => {
|
||||
objId = obj.id;
|
||||
const q = new Parse.Query('AnObject');
|
||||
return q.first();
|
||||
})
|
||||
.then(obj => {
|
||||
expect(obj.id).toEqual(objId);
|
||||
server.close(done);
|
||||
})
|
||||
.catch(() => {
|
||||
server.close(done);
|
||||
});
|
||||
},
|
||||
})
|
||||
);
|
||||
@@ -332,7 +330,8 @@ describe('server', () => {
|
||||
appId: 'anOtherTestApp',
|
||||
masterKey: 'anOtherTestMasterKey',
|
||||
serverURL: 'http://localhost:12667/parse',
|
||||
__indexBuildCompletionCallbackForTests: promise => {
|
||||
serverStartComplete: error => {
|
||||
const promise = error ? Promise.reject(error) : Promise.resolve();
|
||||
promise
|
||||
.then(() => {
|
||||
expect(Parse.applicationId).toEqual('anOtherTestApp');
|
||||
|
||||
Reference in New Issue
Block a user