Finished back tests
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Pau 2022-10-17 14:02:18 +02:00
parent 70c9c3d788
commit 9290cd6fb6
3 changed files with 39 additions and 10 deletions

View File

@ -2,4 +2,8 @@ ALTER TABLE `vn`.`supplier` MODIFY COLUMN payMethodFk tinyint(3) unsigned DEFAUL
/* ------------------------------------------------------------------------------------------- */
ALTER TABLE `vn`.`supplier` MODIFY COLUMN supplierActivityFk varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL;
ALTER TABLE `vn`.`supplier` MODIFY COLUMN supplierActivityFk varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL;
/* ------------------------------------------------------------------------------------------- */
ALTER TABLE `vn`.`supplierLog` MODIFY COLUMN userFk int(10) unsigned NULL;

View File

@ -21,14 +21,11 @@ module.exports = Self => {
const models = Self.app.models;
const myOptions = {};
process.stdout.write(typeof(params));
if (typeof(params) == 'string') {
console.log('params was a string, why?');
if (typeof(params) == 'string')
params = JSON.parse(params);
}
params.payDemFk = 1;
params.nickname = params.name;
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
@ -45,7 +42,6 @@ module.exports = Self => {
};
} catch (e) {
if (tx) await tx.rollback();
params.e = e;
return params;
}
};

View File

@ -8,12 +8,41 @@ describe('Supplier newSupplier()', () => {
it('should create a new supplier containing only the name', async() => {
let result = await app.models.Supplier.newSupplier(JSON.stringify(newSupp));
result = result.supplier;
expect(result.name).toEqual('TestSupplier-1');
expect(result.payDemFk).toEqual(1);
console.log(result);
expect(result.id).toEqual(443);
// const createdSupplier = await app.models.Supplier.
const createdSupplier = await app.models.Supplier.findById(result.id);
// process.stdout.write(createdSupplier);
expect(createdSupplier.id).toEqual(result.id);
expect(createdSupplier.name).toEqual(result.name);
expect(createdSupplier.account).toBeNull();
expect(createdSupplier.nif).toBeNull();
expect(createdSupplier.phone).toBeNull();
expect(createdSupplier.retAccount).toBeNull();
expect(createdSupplier.commission).toBeFalse();
expect(createdSupplier.created).toBeLessThanOrEqual(new Date);
expect(createdSupplier.postcodeFk).toBeNull();
expect(createdSupplier.isActive).toBeTrue();
expect(createdSupplier.isOfficial).toBeTrue();
expect(createdSupplier.isSerious).toBeTrue();
expect(createdSupplier.note).toBeNull();
expect(createdSupplier.street).toBeNull();
expect(createdSupplier.city).toBeNull();
expect(createdSupplier.provinceFk).toBeNull();
expect(createdSupplier.postCode).toBeNull();
expect(createdSupplier.payMethodFk).toBeNull();
expect(createdSupplier.payDemFk).toEqual(1);
expect(createdSupplier.payDay).toBeNull();
expect(createdSupplier.nickname).toEqual(result.name);
expect(createdSupplier.workerFk).toBeNull();
expect(createdSupplier.sageTaxTypeFk).toBeNull();
expect(createdSupplier.sageTransactionTypeFk).toBeNull();
expect(createdSupplier.sageWithholdingFk).toBeNull();
expect(createdSupplier.isPayMethodChecked).toBeFalse();
expect(createdSupplier.supplierActivityFk).toBeNull();
expect(createdSupplier.healthRegister).toBeNull();
});
});