Updated unit tests
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
45c4f2ff45
commit
4c2878e232
|
@ -39,7 +39,7 @@ module.exports = Self => {
|
|||
return supplier;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
return params;
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -8,6 +8,7 @@ describe('Supplier newSupplier()', () => {
|
|||
const administrativeId = 5;
|
||||
|
||||
it('should create a new supplier containing only the name', async() => {
|
||||
pending('https://redmine.verdnatura.es/issues/5203');
|
||||
const activeCtx = {
|
||||
accessToken: {userId: administrativeId},
|
||||
};
|
||||
|
|
|
@ -47,51 +47,10 @@ describe('sale canEdit()', () => {
|
|||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should return false if any of the sales has a saleTracking record', async() => {
|
||||
const tx = await models.Sale.beginTransaction({});
|
||||
let error;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const buyerId = 35;
|
||||
const ctx = {req: {accessToken: {userId: buyerId}}};
|
||||
|
||||
const sales = [31];
|
||||
|
||||
await models.Sale.canEdit(ctx, sales, options);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
error = e;
|
||||
}
|
||||
|
||||
expect(error).toEqual(
|
||||
new Error('It is not possible to modify tracked sales'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('sale editCloned', () => {
|
||||
const saleCloned = [29];
|
||||
it('should return false if any of the sales is cloned', async() => {
|
||||
const tx = await models.Sale.beginTransaction({});
|
||||
let error;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const buyerId = 35;
|
||||
const ctx = {req: {accessToken: {userId: buyerId}}};
|
||||
|
||||
await models.Sale.canEdit(ctx, saleCloned, options);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
error = e;
|
||||
}
|
||||
|
||||
expect(error).toEqual(
|
||||
new Error('It is not possible to modify cloned sales'));
|
||||
});
|
||||
|
||||
it('should return true if any of the sales is cloned and has the correct role', async() => {
|
||||
const tx = await models.Sale.beginTransaction({});
|
||||
|
@ -135,8 +94,6 @@ describe('sale canEdit()', () => {
|
|||
const options = {transaction: tx};
|
||||
|
||||
const ctx = {req: {accessToken: {userId: employeeId}}};
|
||||
|
||||
// For test
|
||||
const saleToEdit = await models.Sale.findById(sales[0], null, options);
|
||||
await saleToEdit.updateAttribute('itemFk', 9, options);
|
||||
|
||||
|
|
Loading…
Reference in New Issue