[WIP] Enable test suite to be randomized (#7265)
* initial run * Update ParseGraphQLServer.spec.js * temporarily enable reporter * Bump retry limit * fix undefined database * try to catch error * Handle LiveQueryServers * Update Config.js * fast-fail false * Remove usage of AppCache * oops * Update contributing guide * enable debugger, try network retry attempt 1 * Fix ldap unbinding * move non specs to support * add missing mock adapter * fix Parse.Push * RestController should match batch.spec.js * Remove request attempt limit * handle index.spec.js * Update CHANGELOG.md * Handle error: tuple concurrently updated * test transactions * Clear RedisCache after every test * LoggerController.spec.js * Update schemas.spec.js * finally fix transactions * fix geopoint deadlock * transaction with clean database * batch.spec.js
This commit is contained in:
@@ -26,10 +26,15 @@ const successfulIOS = function (body, installations) {
|
||||
return Promise.all(promises);
|
||||
};
|
||||
|
||||
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
|
||||
|
||||
const pushCompleted = async pushId => {
|
||||
let result = await Parse.Push.getPushStatus(pushId);
|
||||
const query = new Parse.Query('_PushStatus');
|
||||
query.equalTo('objectId', pushId);
|
||||
let result = await query.first({ useMasterKey: true });
|
||||
while (!(result && result.get('status') === 'succeeded')) {
|
||||
result = await Parse.Push.getPushStatus(pushId);
|
||||
await sleep(100);
|
||||
result = await query.first({ useMasterKey: true });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -568,7 +573,7 @@ describe('PushController', () => {
|
||||
await pushCompleted(pushStatusId);
|
||||
});
|
||||
|
||||
it('should properly report failures in _PushStatus', done => {
|
||||
it('should properly report failures in _PushStatus', async () => {
|
||||
const pushAdapter = {
|
||||
send: function (body, installations) {
|
||||
return installations.map(installation => {
|
||||
@@ -593,30 +598,27 @@ describe('PushController', () => {
|
||||
badge: 1,
|
||||
},
|
||||
};
|
||||
const config = Config.get(Parse.applicationId);
|
||||
const auth = {
|
||||
isMaster: true,
|
||||
};
|
||||
const pushController = new PushController();
|
||||
reconfigureServer({
|
||||
await reconfigureServer({
|
||||
push: { adapter: pushAdapter },
|
||||
})
|
||||
.then(() => {
|
||||
return pushController.sendPush(payload, where, config, auth);
|
||||
})
|
||||
.then(() => {
|
||||
fail('should not succeed');
|
||||
done();
|
||||
})
|
||||
.catch(() => {
|
||||
const query = new Parse.Query('_PushStatus');
|
||||
query.find({ useMasterKey: true }).then(results => {
|
||||
expect(results.length).toBe(1);
|
||||
const pushStatus = results[0];
|
||||
expect(pushStatus.get('status')).toBe('failed');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
const config = Config.get(Parse.applicationId);
|
||||
try {
|
||||
await pushController.sendPush(payload, where, config, auth);
|
||||
fail();
|
||||
} catch (e) {
|
||||
const query = new Parse.Query('_PushStatus');
|
||||
let results = await query.find({ useMasterKey: true });
|
||||
while (results.length === 0) {
|
||||
results = await query.find({ useMasterKey: true });
|
||||
}
|
||||
expect(results.length).toBe(1);
|
||||
const pushStatus = results[0];
|
||||
expect(pushStatus.get('status')).toBe('failed');
|
||||
}
|
||||
});
|
||||
|
||||
it('should support full RESTQuery for increment', async () => {
|
||||
@@ -1237,7 +1239,7 @@ describe('PushController', () => {
|
||||
const auth = { isMaster: true };
|
||||
const pushController = new PushController();
|
||||
|
||||
let config = Config.get(Parse.applicationId);
|
||||
let config;
|
||||
|
||||
const pushes = [];
|
||||
const pushAdapter = {
|
||||
|
||||
Reference in New Issue
Block a user