8032-devToTest_2440 #3009
|
@ -10,7 +10,6 @@ module.exports = Self => {
|
|||
require('../methods/account/logout')(Self);
|
||||
require('../methods/account/change-password')(Self);
|
||||
require('../methods/account/set-password')(Self);
|
||||
require('../methods/account/handle-user')(Self);
|
||||
|
||||
Self.setUnverifiedPassword = async(id, pass, options) => {
|
||||
const {emailVerified} = await models.VnUser.findById(id, {fields: ['emailVerified']}, options);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const {models} = require('vn-loopback/server/server');
|
||||
|
||||
describe('Account handleUser()', () => {
|
||||
describe('Device handleUser()', () => {
|
||||
const ctx = {req: {accessToken: {userId: 9}}};
|
||||
|
||||
it('should return data from user', async() => {
|
||||
|
@ -9,7 +9,7 @@ describe('Account handleUser()', () => {
|
|||
const nameApp = 'warehouse';
|
||||
const versionApp = '10';
|
||||
|
||||
const data = await models.Account.handleUser(ctx, androidId, deviceId, versionApp, nameApp);
|
||||
const data = await models.Device.handleUser(ctx, androidId, deviceId, versionApp, nameApp);
|
||||
|
||||
expect(data.numberOfWagons).toBe(2);
|
||||
});
|
|
@ -1,6 +1,7 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
require('../methods/device/handle-user')(Self);
|
||||
Self.rewriteDbError(function(err) {
|
||||
if (err.code === 'ER_DUP_ENTRY')
|
||||
return new UserError(``);
|
||||
|
|
Loading…
Reference in New Issue