feat handleUser refs #6868
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Sergio De la torre 2024-07-16 17:20:35 +02:00
parent 7870416860
commit a82df8e2a2
1 changed files with 6 additions and 11 deletions

View File

@ -1,21 +1,16 @@
const {models} = require('vn-loopback/server/server'); const {models} = require('vn-loopback/server/server');
describe('Account handleUser()', () => { describe('Account handleUser()', () => {
const ctx = {req: {accessToken: {}}}; const ctx = {req: {accessToken: {userId: 9}}};
fit('should throw an error when user/password is wrong', async() => {
const req = models.Account.handleUser(ctx, 'user', 'pass', 'androidid11234567890', 'warehouse', '10');
await expectAsync(req).toBeRejected(); it('should return data from user', async() => {
});
fit('should return data from user', async() => {
const user = 'employee';
const password = 'nightmare';
const androidId = 'androidid11234567890'; const androidId = 'androidid11234567890';
const deviceId = 1;
const nameApp = 'warehouse'; const nameApp = 'warehouse';
const versionApp = '10'; const versionApp = '10';
const req = models.Account.loginApp(ctx, user, password, androidId, nameApp, versionApp); const data = await models.Account.handleUser(ctx, androidId, deviceId, versionApp, nameApp);
await expectAsync(req).toBeResolved();
expect(data.numberOfWagons).toBe(2);
}); });
}); });