diff --git a/modules/account/back/methods/account/specs/handle-user.spec.js b/modules/account/back/methods/account/specs/handle-user.spec.js index 621ff28ae..486d9dc7a 100644 --- a/modules/account/back/methods/account/specs/handle-user.spec.js +++ b/modules/account/back/methods/account/specs/handle-user.spec.js @@ -1,21 +1,16 @@ const {models} = require('vn-loopback/server/server'); describe('Account handleUser()', () => { - const ctx = {req: {accessToken: {}}}; - fit('should throw an error when user/password is wrong', async() => { - const req = models.Account.handleUser(ctx, 'user', 'pass', 'androidid11234567890', 'warehouse', '10'); + const ctx = {req: {accessToken: {userId: 9}}}; - await expectAsync(req).toBeRejected(); - }); - - fit('should return data from user', async() => { - const user = 'employee'; - const password = 'nightmare'; + it('should return data from user', async() => { const androidId = 'androidid11234567890'; + const deviceId = 1; const nameApp = 'warehouse'; const versionApp = '10'; - const req = models.Account.loginApp(ctx, user, password, androidId, nameApp, versionApp); - await expectAsync(req).toBeResolved(); + const data = await models.Account.handleUser(ctx, androidId, deviceId, versionApp, nameApp); + + expect(data.numberOfWagons).toBe(2); }); });