mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
* Fix Social Push notifications * Fix code formatting issues * Fix commented issues * Fix Syntax errors * update push notify dependency * specify push-notify version * change how apn key is loaded * feat(push-notifications): improve logging * feat(push-notifications): disable v2 push notifications * test(push-notifications): add unit tests and improve integration ones * fix(push-notifications): throw when required params are missing * fix(tests): correct descriptions and remove wrong comment * fix(push-notifications): trim APN key * fix(apn): log feedback only if it has data * fix(apn): load cert and key differently * fix(tests): correctly load apn during tests * download creds from S3 and create AWS lib * convert s3 buffer to a string * fix(apn): remove console.log and do not use cert twice * invert key and cert, disable failing test * invert key and cert
33 lines
870 B
JavaScript
33 lines
870 B
JavaScript
import {
|
|
generateUser,
|
|
translate as t,
|
|
} from '../../../../helpers/api-integration/v3';
|
|
|
|
describe('DELETE /user/push-devices', () => {
|
|
let user;
|
|
let regId = '10';
|
|
let type = 'ios';
|
|
|
|
beforeEach(async () => {
|
|
user = await generateUser();
|
|
});
|
|
|
|
it('returns an error if user does not have the push device', async () => {
|
|
await expect(user.del(`/user/push-devices/${regId}`))
|
|
.to.eventually.be.rejected.and.eql({
|
|
code: 404,
|
|
error: 'NotFound',
|
|
message: t('pushDeviceNotFound'),
|
|
});
|
|
});
|
|
|
|
it('removes a push device from the user', async () => {
|
|
await user.post('/user/push-devices', {type, regId});
|
|
let response = await user.del(`/user/push-devices/${regId}`);
|
|
await user.sync();
|
|
|
|
expect(response.message).to.equal(t('pushDeviceRemoved'));
|
|
expect(user.pushDevices.length).to.equal(0);
|
|
});
|
|
});
|