refs #6397 test back
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2024-01-18 11:43:05 +01:00
parent 7cb7c7dace
commit e9c1f125a5
1 changed files with 27 additions and 0 deletions

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