refs #6915 test_master24_8 #2067
|
@ -14,6 +14,8 @@ describe('Client Create', () => {
|
|||
provinceFk: 1
|
||||
};
|
||||
|
||||
const errorMail = `An email is necessary`;
|
||||
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: 9},
|
||||
|
@ -48,6 +50,31 @@ describe('Client Create', () => {
|
|||
}
|
||||
});
|
||||
|
||||
it('should not create a new account', async() => {
|
||||
const tx = await models.Client.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const client = await models.Client.createWithUser(newAccount, options);
|
||||
const account = await models.VnUser.findOne({where: {name: newAccount.userName}}, options);
|
||||
|
||||
expect(account.name).toEqual(newAccount.userName);
|
||||
expect(client.id).toEqual(account.id);
|
||||
expect(client.name).toEqual(newAccount.name);
|
||||
expect(client.fi).toEqual(newAccount.fi);
|
||||
expect(client.socialName).toEqual(newAccount.socialName);
|
||||
expect(client.businessTypeFk).toEqual(newAccount.businessTypeFk);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
|
||||
expect(errorMail).toEqual(`An email is necessary`);
|
||||
});
|
||||
|
||||
it('should create a new account', async() => {
|
||||
const tx = await models.Client.beginTransaction({});
|
||||
|
||||
|
|
Loading…
Reference in New Issue