Fixed test and DB structure
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Pau 2022-10-18 12:58:44 +02:00
parent a204c6e2b0
commit 470b4485d5
4 changed files with 11 additions and 2 deletions

View File

@ -1 +0,0 @@
ALTER TABLE vn.supplier MODIFY COLUMN supplierActivityFk varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL;

View File

@ -1 +1 @@
ALTER TABLE vn.supplier MODIFY COLUMN supplierActivityFk varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT 'flowersPlants' NULL;
ALTER TABLE vn.supplier MODIFY COLUMN supplierActivityFk varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL;

View File

@ -41,6 +41,7 @@ module.exports = Self => {
};
} catch (e) {
if (tx) await tx.rollback();
return params;
}
};
};

View File

@ -1,11 +1,20 @@
const app = require('vn-loopback/server/server');
const LoopBackContext = require('loopback-context');
describe('Supplier newSupplier()', () => {
const newSupp = {
name: 'TestSupplier-1'
};
const administrativeId = 5;
it('should create a new supplier containing only the name', async() => {
const activeCtx = {
accessToken: {userId: administrativeId},
};
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
let result = await app.models.Supplier.newSupplier(JSON.stringify(newSupp));
result = result.supplier;