Updated unit tests

This commit is contained in:
Joan Sanchez 2020-11-02 08:53:28 +01:00
parent 565bd013bf
commit 61e63cdd48
2 changed files with 11 additions and 3 deletions

View File

@ -7,7 +7,7 @@ describe('Supplier getSummary()', () => {
expect(supplier.id).toEqual(1); expect(supplier.id).toEqual(1);
expect(supplier.name).toEqual('Plants SL'); expect(supplier.name).toEqual('Plants SL');
expect(supplier.nif).toEqual('06089160W'); expect(supplier.nif).toEqual('06089160W');
expect(supplier.account).toEqual('4000000001'); expect(supplier.account).toEqual('4100000001');
expect(supplier.payDay).toEqual(15); expect(supplier.payDay).toEqual(15);
}); });

View File

@ -1,4 +1,5 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
const LoopBackContext = require('loopback-context');
describe('Supplier updateFiscalData', () => { describe('Supplier updateFiscalData', () => {
const supplierId = 1; const supplierId = 1;
@ -7,7 +8,7 @@ describe('Supplier updateFiscalData', () => {
const defaultData = { const defaultData = {
name: 'Plants SL', name: 'Plants SL',
nif: '06089160W', nif: '06089160W',
account: '4000000001', account: '4100000001',
sageTaxTypeFk: 4, sageTaxTypeFk: 4,
sageWithholdingFk: 1, sageWithholdingFk: 1,
sageTransactionTypeFk: 1, sageTransactionTypeFk: 1,
@ -46,7 +47,14 @@ describe('Supplier updateFiscalData', () => {
}); });
it('should update the supplier fiscal data and return the count if changes made', async() => { it('should update the supplier fiscal data and return the count if changes made', async() => {
const ctx = {req: {accessToken: {userId: administrativeId}}}; const activeCtx = {
accessToken: {userId: administrativeId},
};
const ctx = {req: activeCtx};
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
ctx.args = { ctx.args = {
name: 'Weapon Dealer', name: 'Weapon Dealer',
nif: 'B11111111', nif: 'B11111111',