diff --git a/test/api-legacy/pushNotifications.coffee b/test/api-legacy/pushNotifications.coffee index 803e3fee0f..3cbac5ab3d 100644 --- a/test/api-legacy/pushNotifications.coffee +++ b/test/api-legacy/pushNotifications.coffee @@ -11,21 +11,6 @@ describe "Push-Notifications", -> before (done) -> registerNewUser(done, true) - describe "POST /user/pushDevice", -> - it "Registers a DeviceID", (done) -> - request.post(baseURL + "/user/pushDevice").send( - { regId: "123123", type: "android"} - ).end (err, res) -> - expectCode res, 200 - - User.findOne - _id: global.user._id - , (err, _user) -> - expect(_user.pushDevices.length).to.equal 1 - expect(_user.pushDevices[0].regId).to.equal "123123" - - done() - describe "Events that send push notifications", -> pushSpy = { sendNotify: sinon.spy() } diff --git a/test/api/user/pushDevice/POST-pushDevice.test.js b/test/api/user/pushDevice/POST-pushDevice.test.js new file mode 100644 index 0000000000..072f0ff3f9 --- /dev/null +++ b/test/api/user/pushDevice/POST-pushDevice.test.js @@ -0,0 +1,26 @@ +import { + generateUser, + requester, +} from '../../../helpers/api.helper'; + +describe('POST /user/pushDevice', () => { + let api; + + beforeEach(() => { + return generateUser().then((user) => { + api = requester(user); + }); + }); + + it('registers a device id', () => { + return api.post('/user/pushDevice', { + regId: '123123', + type: 'android', + }).then((devices) => { + let device = devices[0]; + expect(device._id).to.exist; + expect(device.regId).to.eql('123123'); + expect(device.type).to.eql('android'); + }); + }); +});