refs #6213 newSuplierSpec
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Pablo Natek 2023-09-18 10:12:32 +02:00
parent 55b53c86c4
commit cdf0951a1b
1 changed files with 18 additions and 0 deletions

View File

@ -124,4 +124,22 @@ describe('loopback model Supplier', () => {
} }
}); });
}); });
describe('after save observer', () => {
fit('should update the account attribute when a new supplier is created', async() => {
const tx = await models.Supplier.beginTransaction({});
const options = {transaction: tx};
try {
const newSupplier = await models.Supplier.create({id: '6969', name: 'Alfred Pennyworth'}, options);
const fetchedSupplier = await models.Supplier.findById(newSupplier.id, null, options);
expect(fetchedSupplier.account).toEqual('4100006969');
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});
}); });