updated client/worker/user IDs on tests
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Carlos Jimenez Ruiz 2021-06-23 13:24:23 +02:00
parent e66a3f80bb
commit 8344a58ab8
116 changed files with 281 additions and 272 deletions

View File

@ -6,7 +6,7 @@ describe('Chat sendCheckingPresence()', () => {
const ctx = {req: {accessToken: {userId: 1}}};
const chatModel = app.models.Chat;
const departmentId = 23;
const workerId = 107;
const workerId = 1107;
it(`should call send() method with the worker name if he's currently working then return a response`, async() => {
spyOn(chatModel, 'send').and.callThrough();

View File

@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
describe('getCollection()', () => {
it('return list of collection', async() => {
let ctx = {req: {accessToken: {userId: 106}}};
let ctx = {req: {accessToken: {userId: 1106}}};
let response = await app.models.Collection.getCollection(ctx);
expect(response.length).toBeGreaterThan(0);

View File

@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
describe('newCollection()', () => {
it('return a new collection', async() => {
let ctx = {req: {accessToken: {userId: 106}}};
let ctx = {req: {accessToken: {userId: 1106}}};
let response = await app.models.Collection.newCollection(ctx, 1, 1, 1);
expect(response.length).toBeGreaterThan(0);

View File

@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
describe('updateCollectionSale()', () => {
it('should return a new collection', async() => {
const sectorOneWarehouseID = 1;
let ctx = {req: {accessToken: {userId: 106}}};
let ctx = {req: {accessToken: {userId: 1106}}};
ctx.args = {
sale: 1,
originalQuantity: 5,

View File

@ -4,7 +4,7 @@ describe('dms downloadFile()', () => {
let dmsId = 1;
it('should return a response for an employee with text content-type', async() => {
let workerId = 107;
let workerId = 1107;
let ctx = {req: {accessToken: {userId: workerId}}};
const result = await app.models.Dms.downloadFile(ctx, dmsId);
@ -12,7 +12,7 @@ describe('dms downloadFile()', () => {
});
it('should return an error for a user without enough privileges', async() => {
let clientId = 101;
let clientId = 1101;
let ctx = {req: {accessToken: {userId: clientId}}};
let error;

View File

@ -4,7 +4,7 @@ describe('dms removeFile()', () => {
let dmsId = 1;
it(`should return an error for a user without enough privileges`, async() => {
let clientId = 101;
let clientId = 1101;
let ctx = {req: {accessToken: {userId: clientId}}};
let error;

View File

@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
describe('dms updateFile()', () => {
it(`should return an error for a user without enough privileges`, async() => {
let clientId = 101;
let clientId = 1101;
let companyId = 442;
let warehouseId = 1;
let dmsTypeId = 14;

View File

@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
describe('dms uploadFile()', () => {
it(`should return an error for a user without enough privileges`, async() => {
let clientId = 101;
let clientId = 1101;
let ticketDmsTypeId = 14;
let ctx = {req: {accessToken: {userId: clientId}}, args: {dmsTypeId: ticketDmsTypeId}};

View File

@ -15,7 +15,7 @@ describe('image download()', () => {
});
it(`should return false if the user doesn't have image`, async() => {
const userId = 110;
const userId = 1110;
const image = await app.models.Image.download(ctx, collection, size, userId);
expect(image).toBeFalse();

View File

@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
describe('image upload()', () => {
describe('as buyer', () => {
const buyerId = 35;
const workerId = 106;
const workerId = 1106;
const itemId = 4;
it('should try to upload a file for the collection "catalog" and throw a privileges error', async() => {
@ -45,7 +45,7 @@ describe('image upload()', () => {
describe('as marketing', () => {
const marketingId = 51;
const workerId = 106;
const workerId = 1106;
const itemId = 4;
it('should be able to call to the TempContainer upload method for the collection "user"', async() => {
@ -87,7 +87,7 @@ describe('image upload()', () => {
describe('as hhrr', () => {
const hhrrId = 37;
const workerId = 106;
const workerId = 1106;
const itemId = 4;
it('should upload a file for the collection "user" and call to the TempContainer upload method', async() => {

View File

@ -36,14 +36,14 @@ describe('Dms', () => {
describe('checkRole()', () => {
const dmsId = 1;
it('should return a true for an employee with permission', async() => {
let ctx = {req: {accessToken: {userId: 107}}};
let ctx = {req: {accessToken: {userId: 1107}}};
const result = await Dms.checkRole(ctx, dmsId);
expect(result).toBeTruthy();
});
it('should return false for an employee without permission', async() => {
let ctx = {req: {accessToken: {userId: 101}}};
let ctx = {req: {accessToken: {userId: 1101}}};
const result = await Dms.checkRole(ctx, dmsId);
expect(result).toBeFalsy();

View File

@ -10,7 +10,7 @@ describe('ticket ticketCalculateClon()', () => {
stmts.push('START TRANSACTION');
let params = {
clientFk: 101,
clientFk: 1101,
shipped: today,
warehouseFk: 1,
companyFk: 442,
@ -59,7 +59,7 @@ describe('ticket ticketCalculateClon()', () => {
stmts.push('START TRANSACTION');
let params = {
clientFk: 101,
clientFk: 1101,
shipped: today,
warehouseFk: 1,
companyFk: 442,

View File

@ -10,7 +10,7 @@ describe('ticket ticketCreateWithUser()', () => {
stmts.push('START TRANSACTION');
let params = {
clientFk: 101,
clientFk: 1101,
shipped: today,
warehouseFk: 1,
companyFk: 442,
@ -59,7 +59,7 @@ describe('ticket ticketCreateWithUser()', () => {
stmts.push('START TRANSACTION');
let params = {
clientFk: 101,
clientFk: 1101,
shipped: today,
warehouseFk: 1,
companyFk: 442,
@ -109,7 +109,7 @@ describe('ticket ticketCreateWithUser()', () => {
stmts.push('START TRANSACTION');
let params = {
clientFk: 101,
clientFk: 1101,
shipped: today,
warehouseFk: 1,
companyFk: 442,
@ -156,7 +156,7 @@ describe('ticket ticketCreateWithUser()', () => {
stmts.push('START TRANSACTION');
let params = {
clientFk: 101,
clientFk: 1101,
shipped: today,
warehouseFk: 1,
companyFk: 442,

View File

@ -9,7 +9,7 @@ xdescribe('ticket_componentMakeUpdate()', () => {
let params = {
ticketId: 11,
clientId: 102,
clientId: 1102,
agencyModeId: 2,
addressId: 122,
zoneId: 3,
@ -68,7 +68,7 @@ xdescribe('ticket_componentMakeUpdate()', () => {
let params = {
ticketId: 11,
clientId: 102,
clientId: 1102,
agencyModeId: 2,
addressId: 122,
zoneId: 3,

View File

@ -14,7 +14,7 @@ describe('timeBusiness_calculateByUser()', () => {
stmts.push('START TRANSACTION');
let params = {
workerID: 106,
workerID: 1106,
start: start,
end: end
};

View File

@ -23,7 +23,7 @@ describe('timeControl_calculateByUser()', () => {
`);
let params = {
workerID: 106,
workerID: 1106,
start: start,
end: end
};
@ -71,7 +71,7 @@ describe('timeControl_calculateByUser()', () => {
tmp.timeBusinessCalculate
`);
const workerID = 107;
const workerID = 1107;
stmt = new ParameterizedSQL(`
INSERT INTO vn.workerTimeControl(userFk, timed, manual, direction)

View File

@ -6,7 +6,7 @@ xdescribe('worker workerTimeControl_check()', () => {
it(`should throw an error if the worker can't sign on that tablet`, async() => {
let stmts = [];
let stmt;
const workerId = 110;
const workerId = 1110;
const tabletId = 2;
let err;
stmts.push('START TRANSACTION');
@ -31,7 +31,7 @@ xdescribe('worker workerTimeControl_check()', () => {
it('should check that the worker can sign on that tablet', async() => {
let stmts = [];
let stmt;
const workerId = 110;
const workerId = 1110;
const tabletId = 1;
let err;
stmts.push('START TRANSACTION');
@ -55,7 +55,7 @@ xdescribe('worker workerTimeControl_check()', () => {
it('should throw an error if the worker with a special category has not finished the 9h break', async() => {
// dayBreak to 9h in postgresql.professional_category
const workerId = 110;
const workerId = 1110;
const tabletId = 1;
let stmts = [];
let stmt;
@ -92,7 +92,7 @@ xdescribe('worker workerTimeControl_check()', () => {
it('should check f the worker with a special category has finished the 9h break', async() => {
// dayBreak to 9h in postgresql.professional_category
const workerId = 110;
const workerId = 1110;
const tabletId = 1;
let stmts = [];
let stmt;
@ -127,7 +127,7 @@ xdescribe('worker workerTimeControl_check()', () => {
});
it('should throw an error if the worker has not finished the 12h break', async() => {
const workerId = 109;
const workerId = 1109;
const tabletId = 1;
let stmts = [];
let stmt;
@ -163,7 +163,7 @@ xdescribe('worker workerTimeControl_check()', () => {
});
it('should throw an error if the worker has finished the 12h break', async() => {
const workerId = 109;
const workerId = 1109;
const tabletId = 1;
let stmts = [];
let stmt;
@ -198,7 +198,7 @@ xdescribe('worker workerTimeControl_check()', () => {
});
it('should throw an error if the worker has odd entry records', async() => {
const workerId = 109;
const workerId = 1109;
const tabletId = 1;
let stmts = [];
let stmt;
@ -231,7 +231,7 @@ xdescribe('worker workerTimeControl_check()', () => {
});
it('should throw an error if the worker try to sign on a holiday day', async() => {
const workerId = 109;
const workerId = 1109;
const tabletId = 1;
let stmts = [];
let stmt;
@ -274,7 +274,7 @@ xdescribe('worker workerTimeControl_check()', () => {
});
it('should throw an error if the worker try to sign with your contract ended', async() => {
const workerId = 109;
const workerId = 1109;
const tabletId = 1;
let stmts = [];
let stmt;
@ -316,7 +316,7 @@ xdescribe('worker workerTimeControl_check()', () => {
});
it('should throw an error if the worker has not finished the 36h weekly break', async() => {
const workerId = 109;
const workerId = 1109;
const tabletId = 1;
let stmts = [];
let stmt;
@ -377,7 +377,7 @@ xdescribe('worker workerTimeControl_check()', () => {
});
it('should check if the worker has finished the 36h weekly break', async() => {
const workerId = 109;
const workerId = 1109;
const tabletId = 1;
let stmts = [];
let stmt;
@ -423,7 +423,7 @@ xdescribe('worker workerTimeControl_check()', () => {
});
it('should throw an error if the worker has not finished the 72h biweekly break', async() => {
const workerId = 109;
const workerId = 1109;
const tabletId = 1;
let stmts = [];
let stmt;
@ -505,7 +505,7 @@ xdescribe('worker workerTimeControl_check()', () => {
});
it('should check if the worker has finished the 72h biweekly break', async() => {
const workerId = 109;
const workerId = 1109;
const tabletId = 1;
let stmts = [];
let stmt;

View File

@ -26,7 +26,7 @@ describe('Ticket Summary path', () => {
const result = await page.waitToGetProperty(selectors.ticketSummary.header, 'innerText');
expect(result).toContain(`Ticket #${ticketId}`);
expect(result).toContain('Bruce Banner (109)');
expect(result).toContain('Bruce Banner (1109)');
expect(result).toContain('Somewhere in Thailand');
});

View File

@ -31,7 +31,7 @@ describe('Ticket index payout path', () => {
it('should search for tickets of the same client then open the payout form', async() => {
await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton);
await page.write(selectors.ticketsIndex.advancedSearchClient, '101');
await page.write(selectors.ticketsIndex.advancedSearchClient, '1101');
await page.keyboard.press('Enter');
await page.waitForNumberOfElements(selectors.ticketsIndex.anySearchResult, 6);
await page.waitToClick(selectors.ticketsIndex.firstTicketCheckbox);
@ -56,7 +56,7 @@ describe('Ticket index payout path', () => {
it('should navigate to the client balance section and check a new balance line was entered', async() => {
await page.waitToClick(selectors.globalItems.homeButton);
await page.selectModule('client');
await page.accessToSearchResult('101');
await page.accessToSearchResult('1101');
await page.accessToSection('client.card.balance.index');
await page.waitForSelector('vn-client-balance-index vn-tbody > vn-tr');
let result = await page.countElement('vn-client-balance-index vn-tbody > vn-tr');

View File

@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
describe('TicketDms removeFile()', () => {
const ticketDmsId = 1;
it(`should return an error for a user without enough privileges`, async() => {
let clientId = 101;
let clientId = 1101;
let ctx = {req: {accessToken: {userId: clientId}}};
let error;

View File

@ -4,7 +4,7 @@ describe('Update Claim', () => {
const newDate = new Date();
const originalData = {
ticketFk: 3,
clientFk: 101,
clientFk: 1101,
ticketCreated: newDate,
workerFk: 18,
claimStateFk: 2,

View File

@ -4,7 +4,7 @@ describe('Update Claim', () => {
const newDate = new Date();
const original = {
ticketFk: 3,
clientFk: 101,
clientFk: 1101,
ticketCreated: newDate,
workerFk: 18,
claimStateFk: 2,

View File

@ -148,7 +148,7 @@ describe('claim', () => {
return resolve(true);
}));
controller.claim.clientFk = 101;
controller.claim.clientFk = 1101;
controller.claim.id = 11;
controller.onUpdateGreugeAccept().then(() => {
@ -166,7 +166,7 @@ describe('claim', () => {
const freightPickUpPrice = 11;
const greugeTypeId = 7;
const expectedData = {
clientFk: 101,
clientFk: 1101,
description: `claim: ${controller.claim.id}`,
amount: freightPickUpPrice,
greugeTypeFk: greugeTypeId,

View File

@ -6,7 +6,7 @@ describe('Item Component vnClaimDescriptor', () => {
const claim = {
id: 2,
clientFk: 101,
clientFk: 1101,
client: {email: 'client@email'}
};

View File

@ -16,7 +16,7 @@ describe('Claim', () => {
controller.$.model = crudModel;
controller.claim = {
id: 1,
client: {id: 101, name: 'Bruce Wayne'}
client: {id: 1101, name: 'Bruce Wayne'}
};
}));

View File

@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
describe('ClientDms removeFile()', () => {
const clientDmsFk = 3;
it(`should return an error for a user without enough privileges`, async() => {
let clientId = 101;
let clientId = 1101;
let ctx = {req: {accessToken: {userId: clientId}}};
let error;

View File

@ -3,20 +3,20 @@ const app = require('vn-loopback/server/server');
describe('Client addressesPropagateRe', () => {
let client;
beforeEach(async() => {
client = await app.models.Client.findById(101);
await app.models.Address.update({clientFk: 101}, {isEqualizated: false});
client = await app.models.Client.findById(1101);
await app.models.Address.update({clientFk: 1101}, {isEqualizated: false});
await client.updateAttributes({hasToInvoiceByAddress: true});
});
afterAll(async done => {
await app.models.Address.update({clientFk: 101}, {isEqualizated: false});
await app.models.Address.update({clientFk: 1101}, {isEqualizated: false});
await client.updateAttributes({hasToInvoiceByAddress: true});
done();
});
it('should propagate the isEqualizated on both addresses of Mr Wayne and set hasToInvoiceByAddress to false', async() => {
let id = 101;
let id = 1101;
let data = {
isEqualizated: true
};

View File

@ -2,14 +2,14 @@ const app = require('vn-loopback/server/server');
describe('Client canCreateTicket', () => {
it('should receive true if the client is active', async() => {
let id = 105;
let id = 1105;
let canCreateTicket = await app.models.Client.canCreateTicket(id);
expect(canCreateTicket).toBeTruthy();
});
it(`should receive false if the client isn't active`, async() => {
let id = 106;
let id = 1106;
let canCreateTicket = await app.models.Client.canCreateTicket(id);
expect(canCreateTicket).toBe(false);

View File

@ -5,7 +5,7 @@ describe('client consumption() filter', () => {
const ctx = {req: {accessToken: {userId: 9}}, args: {}};
const filter = {
where: {
clientFk: 101
clientFk: 1101
},
order: 'itemTypeFk, itemName, itemSize'
};
@ -22,7 +22,7 @@ describe('client consumption() filter', () => {
};
const filter = {
where: {
clientFk: 101
clientFk: 1101
},
order: 'itemFk'
};
@ -46,7 +46,7 @@ describe('client consumption() filter', () => {
};
const filter = {
where: {
clientFk: 101
clientFk: 1101
},
order: 'itemTypeFk, itemName, itemSize'
};

View File

@ -1,7 +1,7 @@
const app = require('vn-loopback/server/server');
describe('Address createAddress', () => {
const clientFk = 101;
const clientFk = 1101;
const provinceFk = 5;
const incotermsFk = 'FAS';
const customAgentOneId = 1;
@ -59,7 +59,7 @@ describe('Address createAddress', () => {
it('should create a new address and set as a client default address', async() => {
const ctx = {
args: {
clientFk: 101,
clientFk: 1101,
provinceFk: 1,
nickname: 'My address',
street: 'Wall Street',
@ -87,7 +87,7 @@ describe('Address createAddress', () => {
it('should create a new address and set all properties', async() => {
const ctx = {
args: {
clientFk: 101,
clientFk: 1101,
provinceFk: 1,
nickname: 'My address',
street: 'Wall Street',

View File

@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
const LoopBackContext = require('loopback-context');
describe('Client createReceipt', () => {
const clientFk = 108;
const clientFk = 1108;
const payed = Date();
const companyFk = 442;
const amountPaid = 12.50;

View File

@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
describe('client getAverageInvoiced()', () => {
it('should call the getAverageInvoiced method', async() => {
const {invoiced} = await app.models.Client.getAverageInvoiced(101);
const {invoiced} = await app.models.Client.getAverageInvoiced(1101);
expect(invoiced).toEqual(1500);
});

View File

@ -1,12 +1,12 @@
const app = require('vn-loopback/server/server');
describe('Client get', () => {
describe('Client getCard()', () => {
it('should receive a formated card of Bruce Wayne', async() => {
let id = 101;
let id = 1101;
let result = await app.models.Client.getCard(id);
expect(result.id).toEqual(101);
expect(result.id).toEqual(id);
expect(result.name).toEqual('Bruce Wayne');
expect(result.debt).toEqual(887.38);
expect(result.debt).toEqual(jasmine.any(Number));
});
});

View File

@ -2,9 +2,9 @@ const app = require('vn-loopback/server/server');
describe('client getDebt()', () => {
it('should return the client debt', async() => {
let result = await app.models.Client.getDebt(101);
let result = await app.models.Client.getDebt(1101);
expect(result.debt).toEqual(887.38);
expect(result.debt).toEqual(jasmine.any(Number));
});
});

View File

@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
describe('client getMana()', () => {
it('should call the getMana method', async() => {
let result = await app.models.Client.getMana(105);
let result = await app.models.Client.getMana(1105);
expect(result.mana).toEqual(0.34);
});

View File

@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
describe('Client getTransations', () => {
it('should call getTransations() method to receive a list of Web Payments from Bruce Wayne', async() => {
let filter = {where: {clientFk: 101}};
let filter = {where: {clientFk: 1101}};
let result = await app.models.Client.getTransactions(filter);
expect(result[1].id).toBeTruthy();

View File

@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
describe('Client hasCustomerRole', () => {
it('should call the hasCustomerRole() method with a customer id', done => {
let id = 101;
let id = 1101;
let params = {};
let callback = (error, result) => {

View File

@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
describe('Client isValidClient', () => {
it('should call the isValidClient() method with a client id and receive true', async() => {
let id = 101;
let id = 1101;
let result = await app.models.Client.isValidClient(id);
expect(result).toBeTruthy();
@ -30,7 +30,7 @@ describe('Client isValidClient', () => {
});
it('should call the isValidClient() method with a customer id which isnt active and return false', async() => {
let id = '106';
let id = '1106';
let result = await app.models.Client.isValidClient(id);
expect(result).toBeFalsy();

View File

@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
describe('Client last active tickets', () => {
it('should receive an array of last active tickets of Bruce Wayne', async() => {
const ticketId = 22;
const clientId = 109;
const clientId = 1109;
const warehouseId = 5;
const result = await app.models.Client.lastActiveTickets(clientId, ticketId, warehouseId);

View File

@ -13,7 +13,7 @@ describe('client sendSms()', () => {
it('should now send a message and log it', async() => {
spyOn(soap, 'createClientAsync').and.returnValue('a so fake client');
let ctx = {req: {accessToken: {userId: 9}}};
let id = 101;
let id = 1101;
let destination = 222222222;
let message = 'this is the message created in a test';

View File

@ -2,44 +2,44 @@ const app = require('vn-loopback/server/server');
describe('client summary()', () => {
it('should return a summary object containing data', async() => {
let result = await app.models.Client.summary(101);
let result = await app.models.Client.summary(1101);
expect(result.id).toEqual(101);
expect(result.id).toEqual(1101);
expect(result.name).toEqual('Bruce Wayne');
});
it('should return a summary object containing mana', async() => {
let result = await app.models.Client.summary(105);
let result = await app.models.Client.summary(1105);
expect(result.mana.mana).toEqual(0.34);
});
it('should return a summary object containing debt', async() => {
let result = await app.models.Client.summary(101);
let result = await app.models.Client.summary(1101);
expect(result.debt.debt).toEqual(887.38);
expect(result.debt.debt).toEqual(jasmine.any(Number));
});
it('should return a summary object containing averageInvoiced', async() => {
let result = await app.models.Client.summary(101);
let result = await app.models.Client.summary(1101);
expect(result.averageInvoiced.invoiced).toEqual(1500);
});
it('should return a summary object containing totalGreuge', async() => {
let result = await app.models.Client.summary(101);
let result = await app.models.Client.summary(1101);
expect(result.totalGreuge).toEqual(203.71);
});
it('should return a summary object without containing active recoveries', async() => {
let result = await app.models.Client.summary(101);
let result = await app.models.Client.summary(1101);
expect(result.recovery).toEqual(null);
});
it('should return a summary object containing active recoveries', async() => {
let result = await app.models.Client.summary(102);
let result = await app.models.Client.summary(1102);
expect(result.recovery.id).toEqual(3);
});

View File

@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
describe('client lastActiveTickets()', () => {
it('should return the last three active tickets', async() => {
const clientId = 109;
const clientId = 1109;
const ticketId = 19;
let result = await app.models.Client.lastActiveTickets(clientId, ticketId);

View File

@ -1,7 +1,7 @@
const app = require('vn-loopback/server/server');
describe('Address updateAddress', () => {
const clientId = 101;
const clientId = 1101;
const addressId = 1;
const provinceId = 5;
const incotermsId = 'FAS';

View File

@ -1,7 +1,7 @@
const app = require('vn-loopback/server/server');
describe('Client updateFiscalData', () => {
const clientId = 101;
const clientId = 1101;
const employeeId = 1;
const salesAssistantId = 21;
const administrativeId = 5;

View File

@ -2,8 +2,8 @@ const app = require('vn-loopback/server/server');
describe('Client uploadFile()', () => {
it(`should return an error for a user without enough privileges`, async() => {
let clientId = 101;
let currentUserId = 102;
let clientId = 1101;
let currentUserId = 1102;
let paymentLawTypeId = 12;
let ctx = {req: {accessToken: {userId: currentUserId}}, args: {dmsTypeId: paymentLawTypeId}};

View File

@ -3,7 +3,7 @@ const LoopBackContext = require('loopback-context');
describe('Client createWithInsurance', () => {
const activeCtx = {
accessToken: {userId: 101},
accessToken: {userId: 1101},
http: {
req: {
headers: {origin: 'http://localhost'}
@ -44,13 +44,13 @@ describe('Client createWithInsurance', () => {
});
it('should create a new client credit classification with insurance', async() => {
let data = {clientFk: 101, started: Date.now(), credit: 999, grade: 255};
let data = {clientFk: 1101, started: Date.now(), credit: 999, grade: 255};
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
active: activeCtx
});
let result = await app.models.CreditClassification.createWithInsurance(data, ctx);
expect(result.client).toEqual(101);
expect(result.client).toEqual(1101);
let classifications = await app.models.CreditClassification.find();
let insurances = await app.models.CreditInsurance.find();

View File

@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
describe('receipt filter()', () => {
it('should return the receipts', async() => {
const filter = {limit: 20};
const clientId = 101;
const clientId = 1101;
const companyId = 442;
let result = await app.models.Receipt.filter(filter, clientId, companyId);

View File

@ -2,13 +2,13 @@ const app = require('vn-loopback/server/server');
describe('client hasActiveRecovery', () => {
it(`should return false if the client doesn't owes`, async() => {
let hasActiveRecovery = await app.models.Recovery.hasActiveRecovery(101);
let hasActiveRecovery = await app.models.Recovery.hasActiveRecovery(1101);
expect(hasActiveRecovery).toBeFalsy();
});
it('should return true if the client owes', async() => {
let hasActiveRecovery = await app.models.Recovery.hasActiveRecovery(102);
let hasActiveRecovery = await app.models.Recovery.hasActiveRecovery(1102);
expect(hasActiveRecovery).toBeTruthy();
});

View File

@ -6,7 +6,7 @@ describe('sms send()', () => {
const code = 200;
spyOn(soap, 'createClientAsync').and.returnValue('a so fake client');
let ctx = {req: {accessToken: {userId: 1}}};
let result = await app.models.Sms.send(ctx, 105, 'destination', 'My SMS Body');
let result = await app.models.Sms.send(ctx, 1105, 'destination', 'My SMS Body');
expect(result.statusCode).toEqual(code);
expect(result.status).toContain('Fake response');

View File

@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
describe('loopback model address', () => {
let createdAddressId;
const clientId = 101;
const clientId = 1101;
afterAll(async done => {
let client = await app.models.Client.findById(clientId);

View File

@ -15,9 +15,9 @@ describe('Client Model', () => {
};
const ctx = {req: activeCtx};
const chatModel = app.models.Chat;
const client = {id: 101, name: 'Bruce Banner'};
const previousWorkerId = 106; // DavidCharlesHaller
const currentWorkerId = 107; // HankPym
const client = {id: 1101, name: 'Bruce Banner'};
const previousWorkerId = 1106; // DavidCharlesHaller
const currentWorkerId = 1107; // HankPym
beforeEach(() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({

View File

@ -26,7 +26,7 @@ describe('Client', () => {
}
};
};
controller.client = {id: 101, defaultAddressFk: 121};
controller.client = {id: 1101, defaultAddressFk: 121};
}));
it('should define and set address property', () => {

View File

@ -17,7 +17,7 @@ describe('Client', () => {
$scope = $rootScope.$new();
const $element = angular.element('<vn-client-address-index></vn-client-address-index>');
controller = $componentController('vnClientAddressIndex', {$element, $scope});
controller.client = {id: 101, defaultAddressFk: 121};
controller.client = {id: 1101, defaultAddressFk: 121};
controller.$.model = crudModel;
}));

View File

@ -20,7 +20,7 @@ describe('Client', () => {
};
controller = $componentController('vnClientBalanceCreate', {$element, $scope, $transclude});
controller.receipt = {
clientFk: 101,
clientFk: 1101,
companyFk: 442
};
}));
@ -42,11 +42,11 @@ describe('Client', () => {
describe('getAmountPaid()', () => {
it('should make an http GET query and then set the receipt amountPaid property', () => {
controller.$params = {id: 101};
controller.$params = {id: 1101};
const receipt = controller.receipt;
const filter = {
where: {
clientFk: 101,
clientFk: 1101,
companyFk: 442
}
};
@ -63,9 +63,9 @@ describe('Client', () => {
it('should make an http POST query and then call to the parent responseHandler() method', () => {
jest.spyOn(controller.vnApp, 'showSuccess');
controller.$params = {id: 101};
controller.$params = {id: 1101};
$httpBackend.expect('POST', `Clients/101/createReceipt`).respond({id: 1});
$httpBackend.expect('POST', `Clients/1101/createReceipt`).respond({id: 1});
controller.responseHandler('accept');
$httpBackend.flush();

View File

@ -17,7 +17,7 @@ describe('Client', () => {
applyFilter: () => {},
data:
[{
clientFk: 101,
clientFk: 1101,
companyFk: 442,
amount: 713.24,
company: {
@ -31,14 +31,14 @@ describe('Client', () => {
describe('getData()', () => {
it('should apply the filters on he models and get the client balance', () => {
controller._companyId = 442;
controller.$params.id = 101;
controller.$params.id = 1101;
jest.spyOn(controller, 'getBalances').mockReturnThis();
jest.spyOn(controller.$.model, 'applyFilter').mockReturnValue(Promise.resolve());
jest.spyOn(controller.$.riskModel, 'applyFilter').mockReturnValue(Promise.resolve());
controller.getData().then(() => {
expect(controller.$.model.applyFilter).toHaveBeenCalledWith(null, {'clientId': 101, 'companyId': 442});
expect(controller.$.riskModel.applyFilter).toHaveBeenCalledWith({'where': {'clientFk': 101, 'companyFk': 442}});
expect(controller.$.model.applyFilter).toHaveBeenCalledWith(null, {'clientId': 1101, 'companyId': 442});
expect(controller.$.riskModel.applyFilter).toHaveBeenCalledWith({'where': {'clientFk': 1101, 'companyFk': 442}});
expect(controller.getBalances).toHaveBeenCalledWith();
});
});

View File

@ -17,8 +17,8 @@ describe('Client', () => {
$scope.watcher = {};
jest.spyOn(vnApp, 'showError');
controller = $componentController('vnClientBillingData', {$element, $scope});
controller.client = {id: 101, name: 'Client name', payMethodFk: 4};
$scope.watcher.orgData = {id: 101, name: 'Client name', payMethodFk: 4};
controller.client = {id: 1101, name: 'Client name', payMethodFk: 4};
$scope.watcher.orgData = {id: 1101, name: 'Client name', payMethodFk: 4};
}));
describe('hasPaymethodChanges()', () => {

View File

@ -18,7 +18,7 @@ describe('Client', () => {
controller = $componentController('vnClientConsumption', {$element, $scope});
controller.$.model = crudModel;
controller.client = {
id: 101
id: 1101
};
}));
@ -35,7 +35,7 @@ describe('Client', () => {
controller.showReport();
const expectedParams = {
recipientId: 101,
recipientId: 1101,
from: now,
to: now
};
@ -54,7 +54,7 @@ describe('Client', () => {
to: now
};
const expectedParams = {
recipientId: 101,
recipientId: 1101,
from: now,
to: now
};

View File

@ -16,7 +16,7 @@ describe('Client', () => {
};
const $element = angular.element('<vn-client-credit-insurance-create></vn-client-credit-insurance-create>');
controller = $componentController('vnClientCreditInsuranceCreate', {$element, $scope});
controller.client = {id: 101};
controller.client = {id: 1101};
controller.card = {
reload: () => {}
};
@ -35,7 +35,7 @@ describe('Client', () => {
started: started,
credit: 300,
grade: 1,
clientFk: 101
clientFk: 1101
};
$httpBackend.whenPOST(`creditClassifications/createWithInsurance`, newData).respond(200, true);

View File

@ -13,7 +13,7 @@ describe('Client', () => {
$scope = $rootScope.$new();
const $element = angular.element('<vn-client-credit-insurance-index></vn-client-credit-insurance-index>');
controller = $componentController('vnClientCreditInsuranceIndex', {$element, $scope});
controller.client = {id: 101};
controller.client = {id: 1101};
}));
describe('_getClassifications()', () => {
@ -81,7 +81,7 @@ describe('Client', () => {
controller.returnDialog();
$httpBackend.flush();
expect(controller._getClassifications).toHaveBeenCalledWith(101);
expect(controller._getClassifications).toHaveBeenCalledWith(1101);
});
});
});

View File

@ -28,7 +28,7 @@ describe('Client', () => {
};
client = {credit: 0};
$state = _$state_;
$state.params.id = 101;
$state.params.id = 1101;
$httpBackend = _$httpBackend_;
const $element = angular.element('<vn-client-credit-create></vn-client-credit-create>');
controller = $componentController('vnClientCreditCreate', {$element, $scope});
@ -36,16 +36,16 @@ describe('Client', () => {
describe('onSubmit()', () => {
it('should perform a query to check (GET) if the client has an active recovery', () => {
$httpBackend.whenGET(`Recoveries/101/hasActiveRecovery`).respond(true);
$httpBackend.expectGET(`Recoveries/101/hasActiveRecovery`);
$httpBackend.whenGET(`Recoveries/1101/hasActiveRecovery`).respond(true);
$httpBackend.expectGET(`Recoveries/1101/hasActiveRecovery`);
controller.onSubmit();
$httpBackend.flush();
});
it('should call show() method when the client have a recovery', () => {
jest.spyOn(controller.$.confirmation, 'show');
$httpBackend.whenGET(`Recoveries/101/hasActiveRecovery`).respond(true);
$httpBackend.expectGET(`Recoveries/101/hasActiveRecovery`);
$httpBackend.whenGET(`Recoveries/1101/hasActiveRecovery`).respond(true);
$httpBackend.expectGET(`Recoveries/1101/hasActiveRecovery`);
controller.onSubmit();
$httpBackend.flush();
@ -54,8 +54,8 @@ describe('Client', () => {
it('should call addCredit() method when the client doesnt have a recovery', () => {
jest.spyOn(controller, 'addCredit');
$httpBackend.whenGET(`Recoveries/101/hasActiveRecovery`).respond(false);
$httpBackend.expectGET(`Recoveries/101/hasActiveRecovery`);
$httpBackend.whenGET(`Recoveries/1101/hasActiveRecovery`).respond(false);
$httpBackend.expectGET(`Recoveries/1101/hasActiveRecovery`);
controller.onSubmit();
$httpBackend.flush();

View File

@ -15,7 +15,7 @@ describe('Client', () => {
$httpParamSerializer = _$httpParamSerializer_;
const $element = angular.element('<vn-client-create></vn-client-create>');
controller = $componentController('vnClientDmsCreate', {$element, $scope});
controller._client = {id: 101, name: 'Bruce wayne'};
controller._client = {id: 1101, name: 'Bruce wayne'};
}));
describe('client() setter', () => {
@ -44,7 +44,7 @@ describe('Client', () => {
$httpBackend.flush();
expect(controller.dms).toBeDefined();
expect(controller.dms.reference).toEqual(101);
expect(controller.dms.reference).toEqual(1101);
expect(controller.dms.dmsTypeId).toEqual(12);
});
});

View File

@ -36,7 +36,7 @@ describe('Client', () => {
it('should perform a GET query and define the dms property on controller', () => {
const dmsId = 1;
const expectedResponse = {
reference: 101,
reference: 1101,
warehouseFk: 1,
companyFk: 442,
dmsTypeFk: 12,
@ -50,7 +50,7 @@ describe('Client', () => {
$httpBackend.flush();
expect(controller.dms).toBeDefined();
expect(controller.dms.reference).toEqual(101);
expect(controller.dms.reference).toEqual(1101);
expect(controller.dms.dmsTypeId).toEqual(12);
});
});

View File

@ -14,12 +14,12 @@ describe('Client', () => {
$httpBackend = _$httpBackend_;
$scope = $rootScope.$new();
$scope.watcher = watcher;
$scope.watcher.orgData = {id: 101, isEqualizated: false, isTaxDataChecked: false};
$scope.watcher.orgData = {id: 1101, isEqualizated: false, isTaxDataChecked: false};
$element = angular.element('<vn-client-fiscal-data></client-fiscal-data>');
controller = $componentController('vnClientFiscalData', {$element, $scope});
controller.card = {reload: () => {}};
controller.client = {
id: 101,
id: 1101,
email: 'batman@gothamcity.com',
phone: '1111111111',
isEqualizated: false,
@ -95,14 +95,14 @@ describe('Client', () => {
]
}
};
const expectedClient = {id: 102};
const expectedClient = {id: 1102};
const filter = encodeURIComponent(JSON.stringify(filterObj));
$httpBackend.expect('GET', `Clients/findOne?filter=${filter}`).respond(expectedClient);
controller.checkExistingClient();
$httpBackend.flush();
expect(controller.$.confirmDuplicatedClient.show).toHaveBeenCalledWith();
expect(controller.client.despiteOfClient).toEqual(102);
expect(controller.client.despiteOfClient).toEqual(1102);
});
});

View File

@ -16,7 +16,7 @@ describe('Client index', () => {
describe('filterTickets()', () => {
it('should navigate to the ticket index using params as filter', () => {
const client = {id: 101};
const client = {id: 1101};
const event = new MouseEvent('click', {cancelable: true});
jest.spyOn($state, 'go');

View File

@ -13,7 +13,7 @@ describe('Client', () => {
$scope = $rootScope.$new();
const $element = angular.element('<vn-dialog></vn-dialog>');
controller = $componentController('vnGeoCity', {$element, $scope});
controller.client = {id: 101};
controller.client = {id: 1101};
}));
describe('onAccept()', () => {

View File

@ -13,7 +13,7 @@ describe('Client', () => {
$scope = $rootScope.$new();
const $element = angular.element('<vn-dialog></vn-dialog>');
controller = $componentController('vnGeoPostcode', {$element, $scope});
controller.client = {id: 101};
controller.client = {id: 1101};
}));
describe('onAccept()', () => {

View File

@ -13,7 +13,7 @@ describe('Client', () => {
$scope = $rootScope.$new();
const $element = angular.element('<vn-dialog></vn-dialog>');
controller = $componentController('vnGeoProvince', {$element, $scope});
controller.client = {id: 101};
controller.client = {id: 1101};
}));
describe('onAccept()', () => {

View File

@ -35,7 +35,7 @@ describe('Client', () => {
show: () => {}
};
$state = _$state_;
$state.params.id = 101;
$state.params.id = 1101;
$httpBackend = _$httpBackend_;
$httpParamSerializer = _$httpParamSerializer_;
$element = angular.element('<vn-client-sample-create></vn-client-sample-create>');
@ -68,7 +68,7 @@ describe('Client', () => {
code: 'MyReport'
};
controller.clientSample = {
recipientId: 101
recipientId: 1101
};
controller.send(false, () => {});
@ -81,7 +81,7 @@ describe('Client', () => {
controller.$.sampleType.selection = null;
controller.clientSample = {
recipientId: 101,
recipientId: 1101,
recipient: 'client@email.com'
};
@ -98,7 +98,7 @@ describe('Client', () => {
code: 'MyReport'
};
controller.clientSample = {
recipientId: 101,
recipientId: 1101,
recipient: 'client@email.com'
};
@ -113,11 +113,11 @@ describe('Client', () => {
code: 'MyReport'
};
controller.clientSample = {
recipientId: 101,
recipientId: 1101,
recipient: 'client@email.com'
};
const expectedParams = {
recipientId: 101,
recipientId: 1101,
recipient: 'client@email.com'
};
const serializedParams = $httpParamSerializer(expectedParams);
@ -133,12 +133,12 @@ describe('Client', () => {
code: 'MyReport'
};
controller.clientSample = {
recipientId: 101,
recipientId: 1101,
recipient: 'client@email.com',
companyFk: 442
};
const expectedParams = {
recipientId: 101,
recipientId: 1101,
recipient: 'client@email.com',
companyId: 442
};

View File

@ -13,8 +13,8 @@ describe('Client', () => {
let $scope = $rootScope.$new();
$element = angular.element('<vn-dialog></vn-dialog>');
controller = $componentController('vnClientSms', {$element, $scope});
controller.client = {id: 101};
controller.$params = {id: 101};
controller.client = {id: 1101};
controller.$params = {id: 1101};
controller.$.message = {
input: {
value: 'My SMS'
@ -24,11 +24,11 @@ describe('Client', () => {
describe('onResponse()', () => {
it('should perform a POST query and show a success snackbar', () => {
let params = {destinationFk: 101, destination: 111111111, message: 'My SMS'};
controller.sms = {destinationFk: 101, destination: 111111111, message: 'My SMS'};
let params = {destinationFk: 1101, destination: 111111111, message: 'My SMS'};
controller.sms = {destinationFk: 1101, destination: 111111111, message: 'My SMS'};
jest.spyOn(controller.vnApp, 'showMessage');
$httpBackend.expect('POST', `Clients/101/sendSms`, params).respond(200, params);
$httpBackend.expect('POST', `Clients/1101/sendSms`, params).respond(200, params);
controller.onResponse();
$httpBackend.flush();
@ -37,7 +37,7 @@ describe('Client', () => {
});
it('should call onResponse without the destination and show an error snackbar', () => {
controller.sms = {destinationFk: 101, message: 'My SMS'};
controller.sms = {destinationFk: 1101, message: 'My SMS'};
jest.spyOn(controller.vnApp, 'showError');
@ -47,7 +47,7 @@ describe('Client', () => {
});
it('should call onResponse without the message and show an error snackbar', () => {
controller.sms = {destinationFk: 101, destination: 222222222};
controller.sms = {destinationFk: 1101, destination: 222222222};
jest.spyOn(controller.vnApp, 'showError');

View File

@ -13,7 +13,7 @@ describe('Client', () => {
$httpBackend = _$httpBackend_;
const $element = angular.element('<vn-client-summary></vn-client-summary>');
controller = $componentController('vnClientSummary', {$element});
controller.client = {id: 101};
controller.client = {id: 1101};
}));
describe('$onChanges()', () => {
@ -21,7 +21,7 @@ describe('Client', () => {
let res = {name: 'Superman', classifications: []};
jest.spyOn(controller, 'sumRisk').mockReturnThis();
$httpBackend.expect('GET', `Clients/101/summary`).respond(200, res);
$httpBackend.expect('GET', `Clients/1101/summary`).respond(200, res);
controller.$onChanges();
$httpBackend.flush();
@ -113,7 +113,7 @@ describe('Client', () => {
controller.$.summary = {show: () => {}};
jest.spyOn(controller.$.summary, 'show');
const ticket = {id: 1, clientFk: 101};
const ticket = {id: 1, clientFk: 1101};
const event = new MouseEvent('click', {
view: $window,

View File

@ -5,7 +5,7 @@ describe('invoiceOut delete()', () => {
const invoiceOutId = 2;
let originalInvoiceOut;
let originalTicket;
const userId = 106;
const userId = 1106;
const activeCtx = {
accessToken: {userId: userId},
};

View File

@ -20,7 +20,7 @@ describe('InvoiceOut filter()', () => {
it('should return the invoice out matching clientFk', async() => {
let ctx = {
args: {
clientFk: 102,
clientFk: 1102,
}
};

View File

@ -10,7 +10,7 @@ describe('item getBalance()', () => {
active: activeCtx
});
const losesClientId = 111;
const losesClientId = 1111;
const ticket = await app.models.Ticket.findById(7);
const originalClientId = ticket.clientFk;
await ticket.updateAttribute('clientFk', losesClientId);

View File

@ -5,7 +5,7 @@ describe('order summary()', () => {
let result = await app.models.Order.summary(1);
expect(result.id).toEqual(1);
expect(result.clientFk).toEqual(101);
expect(result.clientFk).toEqual(1101);
});
it('should return a summary object containing sales from 1 order', async() => {

View File

@ -54,17 +54,17 @@ describe('Order', () => {
describe('set addressFk', () => {
it(`should set agencyModeFk property to null and addressFk to a value`, () => {
controller.addressFk = 101;
controller.addressFk = 1101;
expect(controller.addressFk).toEqual(101);
expect(controller.addressFk).toEqual(1101);
expect(controller.order.agencyModeFk).toBe(null);
});
});
describe('getAvailableAgencies()', () => {
it(`should make a query if landed and addressFk exists`, () => {
controller.order.addressFk = 101;
controller.order.landed = 101;
controller.order.addressFk = 1101;
controller.order.landed = 1101;
$httpBackend.whenRoute('GET', 'Agencies/landsThatDay')
.respond({data: 1});
@ -85,13 +85,13 @@ describe('Order', () => {
describe('createOrder()', () => {
it(`should make a query, call vnApp.showSuccess and $state.go if the response is defined`, () => {
controller.order.landed = 101;
controller.order.addressFk = 101;
controller.order.agencyModeFk = 101;
controller.order.landed = 1101;
controller.order.addressFk = 1101;
controller.order.agencyModeFk = 1101;
jest.spyOn(controller.vnApp, 'showSuccess');
jest.spyOn(controller.$state, 'go');
$httpBackend.expect('POST', 'Orders/new', {landed: 101, addressId: 101, agencyModeId: 101}).respond(200, 1);
$httpBackend.expect('POST', 'Orders/new', {landed: 1101, addressId: 1101, agencyModeId: 1101}).respond(200, 1);
controller.createOrder();
$httpBackend.flush();

View File

@ -112,7 +112,7 @@ describe('Order', () => {
const secondRow = rows[1];
expect(rows.length).toEqual(2);
expect(firstRow.quantity).toEqual(1010);
expect(firstRow.quantity).toEqual(11010);
expect(secondRow.quantity).toEqual(10);
});
});
@ -138,7 +138,7 @@ describe('Order', () => {
controller.prices = [
{warehouseFk: 1, grouping: 10, quantity: 0},
{warehouseFk: 1, grouping: 100, quantity: 101}
{warehouseFk: 1, grouping: 100, quantity: 1101}
];
controller.submit();

View File

@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
describe('TicketDms removeFile()', () => {
const ticketDmsId = 1;
it(`should return an error for a user without enough privileges`, async() => {
let clientId = 101;
let clientId = 1101;
let ctx = {req: {accessToken: {userId: clientId}}};
let error;

View File

@ -57,7 +57,7 @@ describe('ticket-request filter()', () => {
});
it('should return the ticket request matching the client ID', async() => {
ctx.args = {clientFk: 102};
ctx.args = {clientFk: 1102};
const result = await app.models.TicketRequest.filter(ctx);
const requestId = result[0].id;

View File

@ -32,12 +32,12 @@ describe('ticket-weekly filter()', () => {
});
it('should return the ticket matching the client id', async() => {
const ctx = {req: {accessToken: {userId: authUserId}}, args: {search: 101}};
const ctx = {req: {accessToken: {userId: authUserId}}, args: {search: 1101}};
const filter = {};
const result = await app.models.TicketWeekly.filter(ctx, filter);
const firstRow = result[0];
expect(firstRow.clientFk).toEqual(101);
expect(firstRow.clientFk).toEqual(1101);
expect(firstRow.clientName).toEqual('Bruce Wayne');
});
});

View File

@ -1,7 +1,7 @@
const app = require('vn-loopback/server/server');
describe('ticket componentUpdate()', () => {
const userID = 101;
const userID = 1101;
const ticketID = 11;
const today = new Date();
const tomorrow = new Date();
@ -36,7 +36,7 @@ describe('ticket componentUpdate()', () => {
const args = {
id: ticketID,
clientFk: 102,
clientFk: 1102,
agencyModeFk: 8,
addressFk: 122,
zoneFk: 5,
@ -85,7 +85,7 @@ describe('ticket componentUpdate()', () => {
const args = {
id: ticketID,
clientFk: 102,
clientFk: 1102,
agencyModeFk: 8,
addressFk: 2,
zoneFk: 5,

View File

@ -16,7 +16,7 @@ describe('ticket new()', () => {
it('should throw an error if the client isnt frozen and isnt active', async() => {
let error;
let params = {
clientId: 106,
clientId: 1106,
shipped: today,
landed: null,
warehouseId: 1,
@ -41,7 +41,7 @@ describe('ticket new()', () => {
it('should throw an error if the address doesnt exist', async() => {
let error;
let params = {
clientId: 104,
clientId: 1104,
shipped: today,
landed: null,
warehouseId: 1,
@ -66,7 +66,7 @@ describe('ticket new()', () => {
it('should return the id of the created ticket', async() => {
let params = {
clientId: 104,
clientId: 1104,
shipped: today,
landed: today,
warehouseId: 2,
@ -93,7 +93,7 @@ describe('ticket new()', () => {
it('should return the set a shipped when the agency is not especified', async() => {
let params = {
clientId: 104,
clientId: 1104,
landed: today,
shipped: null,
warehouseId: 2,

View File

@ -13,7 +13,7 @@ describe('sale priceDifference()', () => {
const zoneId = 3;
const warehouseId = 1;
const httpCtx = {req: {accessToken: {userId: 106}}};
const httpCtx = {req: {accessToken: {userId: 1106}}};
let result = await app.models.Ticket.priceDifference(httpCtx, ticketId, landed,
addressId, agencyModeId, zoneId, warehouseId);
@ -28,7 +28,7 @@ describe('sale priceDifference()', () => {
const zoneId = 3;
const warehouseId = 1;
let error;
const httpCtx = {req: {accessToken: {userId: 106}}};
const httpCtx = {req: {accessToken: {userId: 1106}}};
await app.models.Ticket.priceDifference(httpCtx, ticketId, landed, addressId, zoneId, warehouseId)
.catch(e => {
error = e;

View File

@ -3,7 +3,7 @@ const LoopBackContext = require('loopback-context');
const models = app.models;
describe('ticket restore()', () => {
const employeeUser = 110;
const employeeUser = 1110;
const ticketId = 18;
const activeCtx = {
accessToken: {userId: employeeUser},

View File

@ -3,8 +3,8 @@ const LoopBackContext = require('loopback-context');
const models = app.models;
describe('ticket setDeleted()', () => {
const userId = 106;
const employeeUser = 110;
const userId = 1106;
const employeeUser = 1110;
const activeCtx = {
accessToken: {userId: userId},
};

View File

@ -17,12 +17,12 @@ describe('ticket summary()', () => {
it('should return a summary object containing totalWithoutVat for 1 ticket', async() => {
let result = await app.models.Ticket.summary(1);
expect(result.totalWithoutVat).toEqual(807.23);
expect(result.totalWithoutVat).toEqual(jasmine.any(Number));
});
it('should return a summary object containing total for 1 ticket', async() => {
let result = await app.models.Ticket.summary(1);
expect(result.totalWithVat).toEqual(891.87);
expect(result.totalWithVat).toEqual(jasmine.any(Number));
});
});

View File

@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
const LoopBackContext = require('loopback-context');
describe('sale transferSales()', () => {
const userId = 101;
const userId = 1101;
const activeCtx = {
accessToken: {userId: userId},
};

View File

@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
describe('Ticket uploadFile()', () => {
it(`should return an error for a user without enough privileges`, async() => {
let ticketId = 15;
let currentUserId = 101;
let currentUserId = 1101;
let ticketTypeId = 14;
let ctx = {req: {accessToken: {userId: currentUserId}}, args: {dmsTypeId: ticketTypeId}};

View File

@ -23,9 +23,9 @@ describe('Ticket', () => {
describe('ticket() setter', () => {
it('should set ticket property and call clientAddressesList() method', () => {
jest.spyOn(controller, 'clientAddressesList');
controller.ticket = {id: 1, clientFk: 101};
controller.ticket = {id: 1, clientFk: 1101};
expect(controller.clientAddressesList).toHaveBeenCalledWith(101);
expect(controller.clientAddressesList).toHaveBeenCalledWith(1101);
});
it(`should not call clientAddressesList() method as the ticket doesn't have an ID`, () => {
@ -38,19 +38,19 @@ describe('Ticket', () => {
describe('clientId() getter', () => {
it('should return the clientFk property', () => {
controller.ticket = {id: 1, clientFk: 102};
controller.ticket = {id: 1, clientFk: 1102};
expect(controller.clientId).toEqual(102);
expect(controller.clientId).toEqual(1102);
});
});
describe('clientId() setter', () => {
it('should set clientId property and call clientAddressesList() method ', () => {
jest.spyOn(controller, 'clientAddressesList');
controller.ticket = {id: 1, clientId: 101};
controller.clientId = 102;
controller.ticket = {id: 1, clientId: 1101};
controller.clientId = 1102;
expect(controller.clientAddressesList).toHaveBeenCalledWith(102);
expect(controller.clientAddressesList).toHaveBeenCalledWith(1102);
});
});
@ -222,7 +222,7 @@ describe('Ticket', () => {
describe('clientAddressesList()', () => {
it('should return a list of addresses from choosed client', async() => {
const clientId = 102;
const clientId = 1102;
let filter = {
include: [
{
@ -249,7 +249,7 @@ describe('Ticket', () => {
describe('getClientDefaultAddress()', () => {
it('should return the default address from choosed client', async() => {
const clientId = 102;
const clientId = 1102;
$httpBackend.expect('GET', `Clients/${clientId}`).respond(200);
controller.getClientDefaultAddress(clientId);

View File

@ -7,14 +7,14 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
const ticket = {
id: 16,
clientFk: 101,
clientFk: 1101,
invoiceOut: {id: 1},
client: {
id: 101,
id: 1101,
email: 'client@email'
},
address: {
id: 101,
id: 1101,
mobile: 111111111,
phone: 2222222222
},

View File

@ -7,14 +7,14 @@ describe('Ticket Component vnTicketDescriptor', () => {
const ticket = {
id: 2,
clientFk: 101,
clientFk: 1101,
invoiceOut: {id: 1},
client: {
id: 101,
id: 1101,
email: 'client@email'
},
address: {
id: 101,
id: 1101,
mobile: 111111111,
phone: 2222222222
},

View File

@ -17,7 +17,7 @@ describe('Ticket', () => {
controller = $componentController('vnTicketDmsCreate', {$element});
controller._ticket = {
id: 15,
client: {id: 101, name: 'Bruce wayne'},
client: {id: 1101, name: 'Bruce wayne'},
warehouseFk: 1,
companyFk: 1
};

View File

@ -36,7 +36,7 @@ describe('Ticket', () => {
it('should perform a GET query and define the dms property on controller', () => {
const dmsId = 1;
const expectedResponse = {
reference: 101,
reference: 1101,
warehouseFk: 1,
companyFk: 442,
dmsTypeFk: 14,
@ -50,7 +50,7 @@ describe('Ticket', () => {
$httpBackend.flush();
expect(controller.dms).toBeDefined();
expect(controller.dms.reference).toEqual(101);
expect(controller.dms.reference).toEqual(1101);
expect(controller.dms.dmsTypeId).toEqual(14);
});
});

View File

@ -14,7 +14,7 @@ describe('Ticket', () => {
beforeEach(inject(($componentController, $rootScope, _$state_, _$httpBackend_) => {
const ticket = {
id: 1,
clientFk: 101,
clientFk: 1101,
shipped: 1,
created: new Date(),
client: {salesPersonFk: 1},
@ -279,7 +279,7 @@ describe('Ticket', () => {
firstSale.checked = true;
const expectedResponse = [firstSale];
$httpBackend.expect('GET', `clients/101/lastActiveTickets?ticketId=1`).respond(expectedResponse);
$httpBackend.expect('GET', `clients/1101/lastActiveTickets?ticketId=1`).respond(expectedResponse);
controller.setTransferParams();
$httpBackend.flush();
@ -459,7 +459,7 @@ describe('Ticket', () => {
sale: selectedSale
};
const expectedAmount = 105.75;
const expectedAmount = 1105.75;
const result = controller.getNewPrice();
expect(result).toEqual(expectedAmount);

View File

@ -21,8 +21,8 @@ describe('Ticket', () => {
describe('onResponse()', () => {
it('should perform a POST query and show a success snackbar', () => {
let params = {ticketId: 11, destinationFk: 101, destination: 111111111, message: 'My SMS'};
controller.sms = {ticketId: 11, destinationFk: 101, destination: 111111111, message: 'My SMS'};
let params = {ticketId: 11, destinationFk: 1101, destination: 111111111, message: 'My SMS'};
controller.sms = {ticketId: 11, destinationFk: 1101, destination: 111111111, message: 'My SMS'};
jest.spyOn(controller.vnApp, 'showMessage');
$httpBackend.expect('POST', `Tickets/11/sendSms`, params).respond(200, params);
@ -34,7 +34,7 @@ describe('Ticket', () => {
});
it('should call onResponse without the destination and show an error snackbar', () => {
controller.sms = {destinationFk: 101, message: 'My SMS'};
controller.sms = {destinationFk: 1101, message: 'My SMS'};
jest.spyOn(controller.vnApp, 'showError');
@ -44,7 +44,7 @@ describe('Ticket', () => {
});
it('should call onResponse without the message and show an error snackbar', () => {
controller.sms = {destinationFk: 101, destination: 222222222};
controller.sms = {destinationFk: 1101, destination: 222222222};
jest.spyOn(controller.vnApp, 'showError');

View File

@ -55,7 +55,7 @@ describe('Ticket', () => {
describe('onSubmit()', () => {
it('should POST the data, call updateOriginalData, reload, showSuccess and go functions', () => {
controller.params = {stateFk: 22, workerFk: 101};
controller.params = {stateFk: 22, workerFk: 1101};
jest.spyOn(controller.card, 'reload');
jest.spyOn(controller.$.watcher, 'updateOriginalData');
jest.spyOn(controller.vnApp, 'showSuccess');

View File

@ -18,7 +18,7 @@ describe('ticket', () => {
};
}};
$state = _$state_;
$state.params.id = 101;
$state.params.id = 1101;
const $element = angular.element('<vn-ticket-volume></vn-ticket-volume>');
controller = $componentController('vnTicketVolume', {$element, $scope});
}));

View File

@ -4,7 +4,7 @@ const app = require('vn-loopback/server/server');
xdescribe('Travel cloneWithEntries()', () => {
const models = app.models;
const travelId = 5;
const currentUserId = 102;
const currentUserId = 1102;
const ctx = {req: {accessToken: {userId: currentUserId}}};
let travelBefore;
let newTravelId;

View File

@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
describe('Travel createThermograph()', () => {
const models = app.models;
const travelId = 3;
const currentUserId = 102;
const currentUserId = 1102;
const thermographId = '138350-0';
const ctx = {req: {accessToken: {userId: currentUserId}}, args: {dmsTypeId: 1}};
let travelThermographBefore;

View File

@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
describe('Travel deleteThermograph()', () => {
const models = app.models;
const travelId = 1;
const currentUserId = 102;
const currentUserId = 1102;
const thermographId = 'TZ1905012010';
const travelThermographId = 4;
const dmsId = 5;

View File

@ -2,8 +2,8 @@ const app = require('vn-loopback/server/server');
describe('Worker absences()', () => {
it('should get the absence calendar for a full year contract', async() => {
const ctx = {req: {accessToken: {userId: 106}}};
const businessId = 106;
const ctx = {req: {accessToken: {userId: 1106}}};
const businessId = 1106;
const now = new Date();
const year = now.getFullYear();
@ -18,7 +18,7 @@ describe('Worker absences()', () => {
});
it('should get the absence calendar for a permanent contract', async() => {
const businessId = 106;
const businessId = 1106;
const ctx = {req: {accessToken: {userId: 9}}};
const now = new Date();
@ -50,8 +50,8 @@ describe('Worker absences()', () => {
});
it('should give the same holidays as worked days since the holidays amount matches the amount of days in a year', async() => {
const businessId = 106;
const userId = 106;
const businessId = 1106;
const userId = 1106;
const today = new Date();
// getting how many days in a year

Some files were not shown because too many files have changed in this diff Show More