Skip to content

Commit 328839f

Browse files
authored
Merge 7ff8fe1 into e2a7218
2 parents e2a7218 + 7ff8fe1 commit 328839f

7 files changed

+130
-124
lines changed

package-lock.json

Lines changed: 51 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"lodash": "4.17.21",
4747
"lru-cache": "9.1.1",
4848
"mime": "3.0.0",
49-
"mongodb": "4.10.0",
49+
"mongodb": "5.3.0",
5050
"mustache": "4.2.0",
5151
"parse": "4.1.0",
5252
"path-to-regexp": "6.2.1",

spec/AudienceRouter.spec.js

Lines changed: 29 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -317,54 +317,41 @@ describe('AudiencesRouter', () => {
317317
);
318318
});
319319

320-
it_exclude_dbs(['postgres'])('should support legacy parse.com audience fields', done => {
320+
it_exclude_dbs(['postgres'])('should support legacy parse.com audience fields', async () => {
321321
const database = Config.get(Parse.applicationId).database.adapter.database;
322322
const now = new Date();
323-
Parse._request(
323+
let audience = await Parse._request(
324324
'POST',
325325
'push_audiences',
326326
{ name: 'My Audience', query: JSON.stringify({ deviceType: 'ios' }) },
327327
{ useMasterKey: true }
328-
).then(audience => {
329-
database
330-
.collection('test__Audience')
331-
.updateOne(
332-
{ _id: audience.objectId },
333-
{
334-
$set: {
335-
times_used: 1,
336-
_last_used: now,
337-
},
338-
}
339-
)
340-
.then(result => {
341-
expect(result).toBeTruthy();
342-
database
343-
.collection('test__Audience')
344-
.find({ _id: audience.objectId })
345-
.toArray((error, rows) => {
346-
expect(error).toEqual(undefined);
347-
expect(rows[0]['times_used']).toEqual(1);
348-
expect(rows[0]['_last_used']).toEqual(now);
349-
Parse._request(
350-
'GET',
351-
'push_audiences/' + audience.objectId,
352-
{},
353-
{ useMasterKey: true }
354-
)
355-
.then(audience => {
356-
expect(audience.name).toEqual('My Audience');
357-
expect(audience.query.deviceType).toEqual('ios');
358-
expect(audience.timesUsed).toEqual(1);
359-
expect(audience.lastUsed).toEqual(now.toISOString());
360-
done();
361-
})
362-
.catch(error => {
363-
done.fail(error);
364-
});
365-
});
366-
});
367-
});
328+
);
329+
const result = await database.collection('test__Audience').updateOne(
330+
{ _id: audience.objectId },
331+
{
332+
$set: {
333+
times_used: 1,
334+
_last_used: now,
335+
},
336+
}
337+
);
338+
expect(result).toBeTruthy();
339+
const rows = await database
340+
.collection('test__Audience')
341+
.find({ _id: audience.objectId })
342+
.toArray();
343+
expect(rows[0]['times_used']).toEqual(1);
344+
expect(rows[0]['_last_used']).toEqual(now);
345+
audience = await Parse._request(
346+
'GET',
347+
'push_audiences/' + audience.objectId,
348+
{},
349+
{ useMasterKey: true }
350+
);
351+
expect(audience.name).toEqual('My Audience');
352+
expect(audience.query.deviceType).toEqual('ios');
353+
expect(audience.timesUsed).toEqual(1);
354+
expect(audience.lastUsed).toEqual(now.toISOString());
368355
});
369356

370357
it('should be able to search on audiences', done => {

0 commit comments

Comments
 (0)