Fix flaky test. Give em a little more time. (#5557)
Similar to https://github.com/parse-community/parse-server/pull/3453
This commit is contained in:
@@ -674,78 +674,64 @@ describe('Installations', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('update android device token with duplicate device token', done => {
|
it('update android device token with duplicate device token', async () => {
|
||||||
const installId1 = '11111111-abcd-abcd-abcd-123456789abc';
|
const installId1 = '11111111-abcd-abcd-abcd-123456789abc';
|
||||||
const installId2 = '22222222-abcd-abcd-abcd-123456789abc';
|
const installId2 = '22222222-abcd-abcd-abcd-123456789abc';
|
||||||
const t =
|
const t =
|
||||||
'0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
|
'0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
|
||||||
|
|
||||||
let input = {
|
let input = {
|
||||||
installationId: installId1,
|
installationId: installId1,
|
||||||
deviceToken: t,
|
deviceToken: t,
|
||||||
deviceType: 'android',
|
deviceType: 'android',
|
||||||
};
|
};
|
||||||
let firstObject;
|
await rest.create(config, auth.nobody(config), '_Installation', input);
|
||||||
let secondObject;
|
|
||||||
rest
|
input = {
|
||||||
.create(config, auth.nobody(config), '_Installation', input)
|
installationId: installId2,
|
||||||
.then(() => {
|
deviceType: 'android',
|
||||||
input = {
|
};
|
||||||
installationId: installId2,
|
await rest.create(config, auth.nobody(config), '_Installation', input);
|
||||||
deviceType: 'android',
|
await delay(100);
|
||||||
};
|
|
||||||
return rest.create(config, auth.nobody(config), '_Installation', input);
|
let results = await database.adapter.find(
|
||||||
})
|
'_Installation',
|
||||||
.then(() =>
|
installationSchema,
|
||||||
database.adapter.find(
|
{ installationId: installId1 },
|
||||||
'_Installation',
|
{}
|
||||||
installationSchema,
|
);
|
||||||
{ installationId: installId1 },
|
expect(results.length).toEqual(1);
|
||||||
{}
|
const firstObject = results[0];
|
||||||
)
|
|
||||||
)
|
results = await database.adapter.find(
|
||||||
.then(results => {
|
'_Installation',
|
||||||
firstObject = results[0];
|
installationSchema,
|
||||||
expect(results.length).toEqual(1);
|
{ installationId: installId2 },
|
||||||
return database.adapter.find(
|
{}
|
||||||
'_Installation',
|
);
|
||||||
installationSchema,
|
expect(results.length).toEqual(1);
|
||||||
{ installationId: installId2 },
|
const secondObject = results[0];
|
||||||
{}
|
|
||||||
);
|
// Update second installation to conflict with first installation
|
||||||
})
|
input = {
|
||||||
.then(results => {
|
objectId: secondObject.objectId,
|
||||||
expect(results.length).toEqual(1);
|
deviceToken: t,
|
||||||
secondObject = results[0];
|
};
|
||||||
// Update second installation to conflict with first installation
|
await rest.update(
|
||||||
input = {
|
config,
|
||||||
objectId: secondObject.objectId,
|
auth.nobody(config),
|
||||||
deviceToken: t,
|
'_Installation',
|
||||||
};
|
{ objectId: secondObject.objectId },
|
||||||
return rest.update(
|
input
|
||||||
config,
|
);
|
||||||
auth.nobody(config),
|
await delay(100);
|
||||||
'_Installation',
|
results = await database.adapter.find(
|
||||||
{ objectId: secondObject.objectId },
|
'_Installation',
|
||||||
input
|
installationSchema,
|
||||||
);
|
{ objectId: firstObject.objectId },
|
||||||
})
|
{}
|
||||||
.then(() =>
|
);
|
||||||
database.adapter.find(
|
expect(results.length).toEqual(0);
|
||||||
'_Installation',
|
|
||||||
installationSchema,
|
|
||||||
{ objectId: firstObject.objectId },
|
|
||||||
{}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.then(results => {
|
|
||||||
// The first object should have been deleted
|
|
||||||
expect(results.length).toEqual(0);
|
|
||||||
done();
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
jfail(error);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('update ios device token with duplicate device token', done => {
|
it('update ios device token with duplicate device token', done => {
|
||||||
|
|||||||
Reference in New Issue
Block a user