refs #6397 fix test back
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Carlos Satorres 2024-01-19 14:18:17 +01:00
parent e9c1f125a5
commit 391f418883
1 changed files with 16 additions and 16 deletions

View File

@ -13,8 +13,16 @@ describe('Client Create', () => {
businessTypeFk: 'florist', businessTypeFk: 'florist',
provinceFk: 1 provinceFk: 1
}; };
const newAccount2 = {
const errorMail = `An email is necessary`; userName: 'Deadpool',
fi: '16195279J',
name: 'Wade',
socialName: 'DEADPOOL MARVEL',
street: 'WALL STREET',
city: 'New York',
businessTypeFk: 'florist',
provinceFk: 1
};
beforeAll(async() => { beforeAll(async() => {
const activeCtx = { const activeCtx = {
@ -53,26 +61,18 @@ describe('Client Create', () => {
it('should not create a new account', async() => { it('should not create a new account', async() => {
const tx = await models.Client.beginTransaction({}); const tx = await models.Client.beginTransaction({});
let error;
try { try {
const options = {transaction: tx}; const options = {transaction: tx};
await models.Client.createWithUser(newAccount2, options);
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(); await tx.rollback();
} catch (e) { } catch (e) {
await tx.rollback(); error = e.message;
throw e;
}
expect(errorMail).toEqual(`An email is necessary`); expect(error).toEqual(`An email is necessary`);
await tx.rollback();
}
}); });
it('should create a new account', async() => { it('should create a new account', async() => {