test(supplier): add backTest to check changes in isPayMethodChecked
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
9247bc98f1
commit
7a0221c17d
|
@ -55,13 +55,39 @@ describe('loopback model Supplier', () => {
|
||||||
expect(error).not.toBeDefined();
|
expect(error).not.toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have unchecked isPayMethodChecked', async() => {
|
it('should have checked isPayMethodChecked for payMethod hasVerfified is false', async() => {
|
||||||
const supplier = await models.Supplier.findById(442);
|
const supplier = await models.Supplier.findById(442);
|
||||||
|
await supplier.updateAttribute('isPayMethodChecked', true);
|
||||||
await supplier.updateAttribute('payMethodFk', 5);
|
await supplier.updateAttribute('payMethodFk', 5);
|
||||||
|
|
||||||
const result = await models.Supplier.findById(442);
|
const result = await models.Supplier.findById(442);
|
||||||
|
|
||||||
|
expect(result.isPayMethodChecked).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have unchecked isPayMethodChecked for payMethod hasVerfified is true', async() => {
|
||||||
|
const supplier = await models.Supplier.findById(442);
|
||||||
|
await supplier.updateAttribute('isPayMethodChecked', true);
|
||||||
|
await supplier.updateAttribute('payMethodFk', 2);
|
||||||
|
|
||||||
|
const result = await models.Supplier.findById(442);
|
||||||
|
|
||||||
expect(result.isPayMethodChecked).toEqual(false);
|
expect(result.isPayMethodChecked).toEqual(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should have unchecked isPayMethodChecked for payDay and peyDemFk', async() => {
|
||||||
|
const supplier = await models.Supplier.findById(442);
|
||||||
|
|
||||||
|
await supplier.updateAttribute('isPayMethodChecked', true);
|
||||||
|
await supplier.updateAttribute('payDay', 5);
|
||||||
|
const firstResult = await models.Supplier.findById(442);
|
||||||
|
|
||||||
|
await supplier.updateAttribute('isPayMethodChecked', true);
|
||||||
|
await supplier.updateAttribute('payDemFk', 1);
|
||||||
|
const secondResult = await models.Supplier.findById(442);
|
||||||
|
|
||||||
|
expect(firstResult.isPayMethodChecked).toEqual(false);
|
||||||
|
expect(secondResult.isPayMethodChecked).toEqual(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue