fix mongoose issue

This commit is contained in:
Matteo Pagliazzi
2019-10-13 18:31:43 +02:00
parent a0e5a56bf2
commit a1e3127d36
4 changed files with 3 additions and 14 deletions

View File

@@ -91,7 +91,7 @@
"client:build": "cd website/client && npm run build",
"client:unit": "cd website/client && npm run test:unit",
"start": "gulp nodemon",
"postinstall": "gulp build",
"postinstall": "gulp build && cd website/client && npm install",
"apidoc": "gulp apidoc"
},
"devDependencies": {

View File

@@ -61,15 +61,4 @@ describe('POST /user/push-devices', () => {
expect(user.pushDevices[0].type).to.equal(type);
expect(user.pushDevices[0].regId).to.equal(regId);
});
it('removes a push device to the user', async () => {
await user.post('/user/push-devices', { type, regId });
const response = await user.del(`/user/push-devices/${regId}`);
await user.sync();
expect(response.message).to.equal(t('pushDeviceRemoved'));
expect(response.data[0]).to.not.exist;
expect(user.pushDevices[0]).to.not.exist;
});
});

View File

@@ -6,7 +6,7 @@
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"test:unit": "vue-cli-service test:unit --opts ../../test/mocha.opts",
"lint": "vue-cli-service lint --quiet"
"lint": "vue-cli-service lint"
},
"dependencies": {
"amplitude-js": "^5.3.1",

View File

@@ -91,7 +91,7 @@ api.removePushDevice = {
}
// Concurrency safe update
const pullQuery = { $pull: { pushDevices: { $elemMatch: { regId } } } };
const pullQuery = { $pull: { pushDevices: { regId } } };
await user.update(pullQuery).exec();
// Update the response