Skip to content

Commit da8af05

Browse files
committed
Merge branch 'feat/http-codes' of https://github.com/dblythy/parse-server into feat/http-codes
2 parents ab03153 + 1c42f55 commit da8af05

File tree

72 files changed

+7446
-6535
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+7446
-6535
lines changed

spec/AudienceRouter.spec.js

+55-52
Original file line numberDiff line numberDiff line change
@@ -317,59 +317,62 @@ describe('AudiencesRouter', () => {
317317
);
318318
});
319319

320-
it_id('af1111b5-3251-4b40-8f06-fb0fc624fa91')(it_exclude_dbs(['postgres']))('should support legacy parse.com audience fields', done => {
321-
const database = Config.get(Parse.applicationId).database.adapter.database;
322-
const now = new Date();
323-
Parse._request(
324-
'POST',
325-
'push_audiences',
326-
{ name: 'My Audience', query: JSON.stringify({ deviceType: 'ios' }) },
327-
{ 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();
320+
it_id('af1111b5-3251-4b40-8f06-fb0fc624fa91')(it_exclude_dbs(['postgres']))(
321+
'should support legacy parse.com audience fields',
322+
done => {
323+
const database = Config.get(Parse.applicationId).database.adapter.database;
324+
const now = new Date();
325+
Parse._request(
326+
'POST',
327+
'push_audiences',
328+
{ name: 'My Audience', query: JSON.stringify({ deviceType: 'ios' }) },
329+
{ useMasterKey: true }
330+
).then(audience => {
331+
database
332+
.collection('test__Audience')
333+
.updateOne(
334+
{ _id: audience.objectId },
335+
{
336+
$set: {
337+
times_used: 1,
338+
_last_used: now,
339+
},
340+
}
341+
)
342+
.then(result => {
343+
expect(result).toBeTruthy();
342344

343-
database
344-
.collection('test__Audience')
345-
.find({ _id: audience.objectId })
346-
.toArray()
347-
.then(rows => {
348-
expect(rows[0]['times_used']).toEqual(1);
349-
expect(rows[0]['_last_used']).toEqual(now);
350-
Parse._request(
351-
'GET',
352-
'push_audiences/' + audience.objectId,
353-
{},
354-
{ useMasterKey: true }
355-
)
356-
.then(audience => {
357-
expect(audience.name).toEqual('My Audience');
358-
expect(audience.query.deviceType).toEqual('ios');
359-
expect(audience.timesUsed).toEqual(1);
360-
expect(audience.lastUsed).toEqual(now.toISOString());
361-
done();
362-
})
363-
.catch(error => {
364-
done.fail(error);
365-
});
366-
})
367-
.catch(error => {
368-
done.fail(error);
369-
});
370-
});
371-
});
372-
});
345+
database
346+
.collection('test__Audience')
347+
.find({ _id: audience.objectId })
348+
.toArray()
349+
.then(rows => {
350+
expect(rows[0]['times_used']).toEqual(1);
351+
expect(rows[0]['_last_used']).toEqual(now);
352+
Parse._request(
353+
'GET',
354+
'push_audiences/' + audience.objectId,
355+
{},
356+
{ useMasterKey: true }
357+
)
358+
.then(audience => {
359+
expect(audience.name).toEqual('My Audience');
360+
expect(audience.query.deviceType).toEqual('ios');
361+
expect(audience.timesUsed).toEqual(1);
362+
expect(audience.lastUsed).toEqual(now.toISOString());
363+
done();
364+
})
365+
.catch(error => {
366+
done.fail(error);
367+
});
368+
})
369+
.catch(error => {
370+
done.fail(error);
371+
});
372+
});
373+
});
374+
}
375+
);
373376

374377
it('should be able to search on audiences', done => {
375378
Parse._request(

spec/Auth.spec.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -237,16 +237,10 @@ describe('extendSessionOnUse', () => {
237237
const { shouldUpdateSessionExpiry } = require('../lib/Auth');
238238
let update = new Date(Date.now() - 86410 * 1000);
239239

240-
const res = shouldUpdateSessionExpiry(
241-
{ sessionLength: 86460 },
242-
{ updatedAt: update }
243-
);
240+
const res = shouldUpdateSessionExpiry({ sessionLength: 86460 }, { updatedAt: update });
244241

245242
update = new Date(Date.now() - 43210 * 1000);
246-
const res2 = shouldUpdateSessionExpiry(
247-
{ sessionLength: 86460 },
248-
{ updatedAt: update }
249-
);
243+
const res2 = shouldUpdateSessionExpiry({ sessionLength: 86460 }, { updatedAt: update });
250244

251245
expect(res).toBe(true);
252246
expect(res2).toBe(false);

0 commit comments

Comments
 (0)