refs #6915 test_master24_8 #2067

Merged
alexm merged 561 commits from test_master24_8 into master 2024-02-22 07:31:34 +00:00
1 changed files with 27 additions and 0 deletions
Showing only changes of commit e9c1f125a5 - Show all commits

View File

@ -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({});