diff --git a/back/methods/chat/spec/sendCheckingPresence.spec.js b/back/methods/chat/spec/sendCheckingPresence.spec.js index aa4a80801..e9c61fd21 100644 --- a/back/methods/chat/spec/sendCheckingPresence.spec.js +++ b/back/methods/chat/spec/sendCheckingPresence.spec.js @@ -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(); diff --git a/back/methods/collection/spec/getCollection.spec.js b/back/methods/collection/spec/getCollection.spec.js index 44c7af62f..bfd3e3603 100644 --- a/back/methods/collection/spec/getCollection.spec.js +++ b/back/methods/collection/spec/getCollection.spec.js @@ -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); diff --git a/back/methods/collection/spec/newCollection.spec.js b/back/methods/collection/spec/newCollection.spec.js index bd574db0f..f57716f16 100644 --- a/back/methods/collection/spec/newCollection.spec.js +++ b/back/methods/collection/spec/newCollection.spec.js @@ -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); diff --git a/back/methods/collection/spec/updateCollectionSale.spec.js b/back/methods/collection/spec/updateCollectionSale.spec.js index 83b161a73..951115e54 100644 --- a/back/methods/collection/spec/updateCollectionSale.spec.js +++ b/back/methods/collection/spec/updateCollectionSale.spec.js @@ -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, diff --git a/back/methods/dms/specs/downloadFile.spec.js b/back/methods/dms/specs/downloadFile.spec.js index 701a484df..763c2a0c1 100644 --- a/back/methods/dms/specs/downloadFile.spec.js +++ b/back/methods/dms/specs/downloadFile.spec.js @@ -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; diff --git a/back/methods/dms/specs/removeFile.spec.js b/back/methods/dms/specs/removeFile.spec.js index 1006d1329..28ce5d0fd 100644 --- a/back/methods/dms/specs/removeFile.spec.js +++ b/back/methods/dms/specs/removeFile.spec.js @@ -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; diff --git a/back/methods/dms/specs/updateFile.spec.js b/back/methods/dms/specs/updateFile.spec.js index 2945b1ac9..87ee372ec 100644 --- a/back/methods/dms/specs/updateFile.spec.js +++ b/back/methods/dms/specs/updateFile.spec.js @@ -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; diff --git a/back/methods/dms/specs/uploadFile.spec.js b/back/methods/dms/specs/uploadFile.spec.js index afd70d068..fda911bad 100644 --- a/back/methods/dms/specs/uploadFile.spec.js +++ b/back/methods/dms/specs/uploadFile.spec.js @@ -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}}; diff --git a/back/methods/image/specs/download.spec.js b/back/methods/image/specs/download.spec.js index 328d932a1..758f884ae 100644 --- a/back/methods/image/specs/download.spec.js +++ b/back/methods/image/specs/download.spec.js @@ -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(); diff --git a/back/methods/image/specs/upload.spec.js b/back/methods/image/specs/upload.spec.js index 86b598b49..7cb2ae6f9 100644 --- a/back/methods/image/specs/upload.spec.js +++ b/back/methods/image/specs/upload.spec.js @@ -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() => { diff --git a/back/models/specs/dms.spec.js b/back/models/specs/dms.spec.js index 8e76a4956..93ae1d1e0 100644 --- a/back/models/specs/dms.spec.js +++ b/back/models/specs/dms.spec.js @@ -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(); diff --git a/db/tests/vn/ticketCalculateClon.spec.js b/db/tests/vn/ticketCalculateClon.spec.js index 4015d57db..03814682d 100644 --- a/db/tests/vn/ticketCalculateClon.spec.js +++ b/db/tests/vn/ticketCalculateClon.spec.js @@ -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, diff --git a/db/tests/vn/ticketCreateWithUser.spec.js b/db/tests/vn/ticketCreateWithUser.spec.js index 6728eb2da..1c13be1b3 100644 --- a/db/tests/vn/ticketCreateWithUser.spec.js +++ b/db/tests/vn/ticketCreateWithUser.spec.js @@ -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, diff --git a/db/tests/vn/ticket_componentMakeUpdate.spec.js b/db/tests/vn/ticket_componentMakeUpdate.spec.js index 4954c44f4..a059f1060 100644 --- a/db/tests/vn/ticket_componentMakeUpdate.spec.js +++ b/db/tests/vn/ticket_componentMakeUpdate.spec.js @@ -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, diff --git a/db/tests/vn/timeBusiness_calculateByUser.spec.js b/db/tests/vn/timeBusiness_calculateByUser.spec.js index 0b09447ef..441f567ac 100644 --- a/db/tests/vn/timeBusiness_calculateByUser.spec.js +++ b/db/tests/vn/timeBusiness_calculateByUser.spec.js @@ -14,7 +14,7 @@ describe('timeBusiness_calculateByUser()', () => { stmts.push('START TRANSACTION'); let params = { - workerID: 106, + workerID: 1106, start: start, end: end }; diff --git a/db/tests/vn/timeControl_calculateByUser.spec.js b/db/tests/vn/timeControl_calculateByUser.spec.js index ac442ab7b..2aa16c7a4 100644 --- a/db/tests/vn/timeControl_calculateByUser.spec.js +++ b/db/tests/vn/timeControl_calculateByUser.spec.js @@ -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) diff --git a/db/tests/vn/workerTimeControlCheck.spec.js b/db/tests/vn/workerTimeControlCheck.spec.js index f70a0b1c3..6838665f1 100644 --- a/db/tests/vn/workerTimeControlCheck.spec.js +++ b/db/tests/vn/workerTimeControlCheck.spec.js @@ -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; diff --git a/e2e/paths/05-ticket/16_summary.spec.js b/e2e/paths/05-ticket/16_summary.spec.js index 36ff0f8b8..5095b6f3d 100644 --- a/e2e/paths/05-ticket/16_summary.spec.js +++ b/e2e/paths/05-ticket/16_summary.spec.js @@ -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'); }); diff --git a/e2e/paths/05-ticket/18_index_payout.spec.js b/e2e/paths/05-ticket/18_index_payout.spec.js index 3d83e6fca..343ec1f43 100644 --- a/e2e/paths/05-ticket/18_index_payout.spec.js +++ b/e2e/paths/05-ticket/18_index_payout.spec.js @@ -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'); diff --git a/modules/claim/back/methods/claim-dms/specs/removeFile.spec.js b/modules/claim/back/methods/claim-dms/specs/removeFile.spec.js index b1cd5686a..1cd3b16cb 100644 --- a/modules/claim/back/methods/claim-dms/specs/removeFile.spec.js +++ b/modules/claim/back/methods/claim-dms/specs/removeFile.spec.js @@ -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; diff --git a/modules/claim/back/methods/claim/specs/updateClaim.spec.js b/modules/claim/back/methods/claim/specs/updateClaim.spec.js index a5de92ccf..de7209c18 100644 --- a/modules/claim/back/methods/claim/specs/updateClaim.spec.js +++ b/modules/claim/back/methods/claim/specs/updateClaim.spec.js @@ -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, diff --git a/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js b/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js index 8cdcea4da..4cd4ce528 100644 --- a/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js +++ b/modules/claim/back/methods/claim/specs/updateClaimAction.spec.js @@ -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, diff --git a/modules/claim/front/action/index.spec.js b/modules/claim/front/action/index.spec.js index 06154e5b6..9fb9b75eb 100644 --- a/modules/claim/front/action/index.spec.js +++ b/modules/claim/front/action/index.spec.js @@ -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, diff --git a/modules/claim/front/descriptor/index.spec.js b/modules/claim/front/descriptor/index.spec.js index bca47409c..669a73954 100644 --- a/modules/claim/front/descriptor/index.spec.js +++ b/modules/claim/front/descriptor/index.spec.js @@ -6,7 +6,7 @@ describe('Item Component vnClaimDescriptor', () => { const claim = { id: 2, - clientFk: 101, + clientFk: 1101, client: {email: 'client@email'} }; diff --git a/modules/claim/front/photos/index.spec.js b/modules/claim/front/photos/index.spec.js index 38e77d13f..84df48b44 100644 --- a/modules/claim/front/photos/index.spec.js +++ b/modules/claim/front/photos/index.spec.js @@ -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'} }; })); diff --git a/modules/client/back/methods/client-dms/specs/removeFile.spec.js b/modules/client/back/methods/client-dms/specs/removeFile.spec.js index 01cf1977b..c663e881e 100644 --- a/modules/client/back/methods/client-dms/specs/removeFile.spec.js +++ b/modules/client/back/methods/client-dms/specs/removeFile.spec.js @@ -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; diff --git a/modules/client/back/methods/client/specs/addressesPropagateRe.spec.js b/modules/client/back/methods/client/specs/addressesPropagateRe.spec.js index 2ec91125d..412385092 100644 --- a/modules/client/back/methods/client/specs/addressesPropagateRe.spec.js +++ b/modules/client/back/methods/client/specs/addressesPropagateRe.spec.js @@ -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 }; diff --git a/modules/client/back/methods/client/specs/canCreateTicket.spec.js b/modules/client/back/methods/client/specs/canCreateTicket.spec.js index 9eb1db334..c8bacd364 100644 --- a/modules/client/back/methods/client/specs/canCreateTicket.spec.js +++ b/modules/client/back/methods/client/specs/canCreateTicket.spec.js @@ -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); diff --git a/modules/client/back/methods/client/specs/consumption.spec.js b/modules/client/back/methods/client/specs/consumption.spec.js index f70c09370..277f59a88 100644 --- a/modules/client/back/methods/client/specs/consumption.spec.js +++ b/modules/client/back/methods/client/specs/consumption.spec.js @@ -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' }; diff --git a/modules/client/back/methods/client/specs/createAddress.spec.js b/modules/client/back/methods/client/specs/createAddress.spec.js index 654d41b83..73c9e0297 100644 --- a/modules/client/back/methods/client/specs/createAddress.spec.js +++ b/modules/client/back/methods/client/specs/createAddress.spec.js @@ -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', diff --git a/modules/client/back/methods/client/specs/createReceipt.spec.js b/modules/client/back/methods/client/specs/createReceipt.spec.js index 8d35064a2..cc5526310 100644 --- a/modules/client/back/methods/client/specs/createReceipt.spec.js +++ b/modules/client/back/methods/client/specs/createReceipt.spec.js @@ -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; diff --git a/modules/client/back/methods/client/specs/getAverageInvoiced.spec.js b/modules/client/back/methods/client/specs/getAverageInvoiced.spec.js index fd30270e7..6b4949833 100644 --- a/modules/client/back/methods/client/specs/getAverageInvoiced.spec.js +++ b/modules/client/back/methods/client/specs/getAverageInvoiced.spec.js @@ -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); }); diff --git a/modules/client/back/methods/client/specs/getCard.spec.js b/modules/client/back/methods/client/specs/getCard.spec.js index e8ac7b3bc..f4f6d63c9 100644 --- a/modules/client/back/methods/client/specs/getCard.spec.js +++ b/modules/client/back/methods/client/specs/getCard.spec.js @@ -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)); }); }); diff --git a/modules/client/back/methods/client/specs/getDebt.spec.js b/modules/client/back/methods/client/specs/getDebt.spec.js index 9d3061ebb..0028c640d 100644 --- a/modules/client/back/methods/client/specs/getDebt.spec.js +++ b/modules/client/back/methods/client/specs/getDebt.spec.js @@ -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)); }); }); diff --git a/modules/client/back/methods/client/specs/getMana.spec.js b/modules/client/back/methods/client/specs/getMana.spec.js index e6fb09c90..2db58426c 100644 --- a/modules/client/back/methods/client/specs/getMana.spec.js +++ b/modules/client/back/methods/client/specs/getMana.spec.js @@ -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); }); diff --git a/modules/client/back/methods/client/specs/getTransactions.spec.js b/modules/client/back/methods/client/specs/getTransactions.spec.js index f04cf9050..34db3d1f7 100644 --- a/modules/client/back/methods/client/specs/getTransactions.spec.js +++ b/modules/client/back/methods/client/specs/getTransactions.spec.js @@ -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(); diff --git a/modules/client/back/methods/client/specs/hasCustomerRole.spec.js b/modules/client/back/methods/client/specs/hasCustomerRole.spec.js index 87306afa7..96bc74f8a 100644 --- a/modules/client/back/methods/client/specs/hasCustomerRole.spec.js +++ b/modules/client/back/methods/client/specs/hasCustomerRole.spec.js @@ -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) => { diff --git a/modules/client/back/methods/client/specs/isValidClient.spec.js b/modules/client/back/methods/client/specs/isValidClient.spec.js index 71d7473f1..9d7af1d59 100644 --- a/modules/client/back/methods/client/specs/isValidClient.spec.js +++ b/modules/client/back/methods/client/specs/isValidClient.spec.js @@ -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(); diff --git a/modules/client/back/methods/client/specs/lastActiveTickets.spec.js b/modules/client/back/methods/client/specs/lastActiveTickets.spec.js index 8d06e0584..8ed3c9805 100644 --- a/modules/client/back/methods/client/specs/lastActiveTickets.spec.js +++ b/modules/client/back/methods/client/specs/lastActiveTickets.spec.js @@ -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); diff --git a/modules/client/back/methods/client/specs/sendSms.spec.js b/modules/client/back/methods/client/specs/sendSms.spec.js index d27188d53..c8de1916f 100644 --- a/modules/client/back/methods/client/specs/sendSms.spec.js +++ b/modules/client/back/methods/client/specs/sendSms.spec.js @@ -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'; diff --git a/modules/client/back/methods/client/specs/summary.spec.js b/modules/client/back/methods/client/specs/summary.spec.js index 882abcab2..e09f04205 100644 --- a/modules/client/back/methods/client/specs/summary.spec.js +++ b/modules/client/back/methods/client/specs/summary.spec.js @@ -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); }); diff --git a/modules/client/back/methods/client/specs/threeLastActive.spec.js b/modules/client/back/methods/client/specs/threeLastActive.spec.js index cd76a0b5b..82ee7a5a8 100644 --- a/modules/client/back/methods/client/specs/threeLastActive.spec.js +++ b/modules/client/back/methods/client/specs/threeLastActive.spec.js @@ -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); diff --git a/modules/client/back/methods/client/specs/updateAddress.spec.js b/modules/client/back/methods/client/specs/updateAddress.spec.js index a30dcc96d..a41b9f285 100644 --- a/modules/client/back/methods/client/specs/updateAddress.spec.js +++ b/modules/client/back/methods/client/specs/updateAddress.spec.js @@ -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'; diff --git a/modules/client/back/methods/client/specs/updateFiscalData.spec.js b/modules/client/back/methods/client/specs/updateFiscalData.spec.js index 0b4425db6..9b5aac0b5 100644 --- a/modules/client/back/methods/client/specs/updateFiscalData.spec.js +++ b/modules/client/back/methods/client/specs/updateFiscalData.spec.js @@ -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; diff --git a/modules/client/back/methods/client/specs/uploadFile.spec.js b/modules/client/back/methods/client/specs/uploadFile.spec.js index 15110731e..f52c1e665 100644 --- a/modules/client/back/methods/client/specs/uploadFile.spec.js +++ b/modules/client/back/methods/client/specs/uploadFile.spec.js @@ -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}}; diff --git a/modules/client/back/methods/credit-classification/createWithInsurance.spec.js b/modules/client/back/methods/credit-classification/createWithInsurance.spec.js index 596c9b140..10a00786c 100644 --- a/modules/client/back/methods/credit-classification/createWithInsurance.spec.js +++ b/modules/client/back/methods/credit-classification/createWithInsurance.spec.js @@ -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(); diff --git a/modules/client/back/methods/receipt/specs/filter.spec.js b/modules/client/back/methods/receipt/specs/filter.spec.js index 2af3b3127..a06cb9b51 100644 --- a/modules/client/back/methods/receipt/specs/filter.spec.js +++ b/modules/client/back/methods/receipt/specs/filter.spec.js @@ -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); diff --git a/modules/client/back/methods/recovery/hasActiveRecovery.spec.js b/modules/client/back/methods/recovery/hasActiveRecovery.spec.js index 218d10df5..efd2190dc 100644 --- a/modules/client/back/methods/recovery/hasActiveRecovery.spec.js +++ b/modules/client/back/methods/recovery/hasActiveRecovery.spec.js @@ -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(); }); diff --git a/modules/client/back/methods/sms/send.spec.js b/modules/client/back/methods/sms/send.spec.js index 2c65eab24..c39e2ad6e 100644 --- a/modules/client/back/methods/sms/send.spec.js +++ b/modules/client/back/methods/sms/send.spec.js @@ -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'); diff --git a/modules/client/back/models/specs/address.spec.js b/modules/client/back/models/specs/address.spec.js index 685acc80d..3271c7d8f 100644 --- a/modules/client/back/models/specs/address.spec.js +++ b/modules/client/back/models/specs/address.spec.js @@ -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); diff --git a/modules/client/back/models/specs/client.spec.js b/modules/client/back/models/specs/client.spec.js index a9d479516..0406cfc21 100644 --- a/modules/client/back/models/specs/client.spec.js +++ b/modules/client/back/models/specs/client.spec.js @@ -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({ diff --git a/modules/client/front/address/create/index.spec.js b/modules/client/front/address/create/index.spec.js index b12bc183b..1be4766f5 100644 --- a/modules/client/front/address/create/index.spec.js +++ b/modules/client/front/address/create/index.spec.js @@ -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', () => { diff --git a/modules/client/front/address/index/index.spec.js b/modules/client/front/address/index/index.spec.js index c7b4985c8..2a1f0d19e 100644 --- a/modules/client/front/address/index/index.spec.js +++ b/modules/client/front/address/index/index.spec.js @@ -17,7 +17,7 @@ describe('Client', () => { $scope = $rootScope.$new(); const $element = angular.element(''); controller = $componentController('vnClientAddressIndex', {$element, $scope}); - controller.client = {id: 101, defaultAddressFk: 121}; + controller.client = {id: 1101, defaultAddressFk: 121}; controller.$.model = crudModel; })); diff --git a/modules/client/front/balance/create/index.spec.js b/modules/client/front/balance/create/index.spec.js index 90015be19..e1e698e95 100644 --- a/modules/client/front/balance/create/index.spec.js +++ b/modules/client/front/balance/create/index.spec.js @@ -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(); diff --git a/modules/client/front/balance/index/index.spec.js b/modules/client/front/balance/index/index.spec.js index bdbea3846..e130ac655 100644 --- a/modules/client/front/balance/index/index.spec.js +++ b/modules/client/front/balance/index/index.spec.js @@ -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(); }); }); diff --git a/modules/client/front/billing-data/index.spec.js b/modules/client/front/billing-data/index.spec.js index dd44bd0fa..95700cb5a 100644 --- a/modules/client/front/billing-data/index.spec.js +++ b/modules/client/front/billing-data/index.spec.js @@ -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()', () => { diff --git a/modules/client/front/consumption/index.spec.js b/modules/client/front/consumption/index.spec.js index 9fe92fee1..16b764b56 100644 --- a/modules/client/front/consumption/index.spec.js +++ b/modules/client/front/consumption/index.spec.js @@ -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 }; diff --git a/modules/client/front/credit-insurance/create/index.spec.js b/modules/client/front/credit-insurance/create/index.spec.js index 83cec62f8..36a91ceca 100644 --- a/modules/client/front/credit-insurance/create/index.spec.js +++ b/modules/client/front/credit-insurance/create/index.spec.js @@ -16,7 +16,7 @@ describe('Client', () => { }; const $element = angular.element(''); 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); diff --git a/modules/client/front/credit-insurance/index/index.spec.js b/modules/client/front/credit-insurance/index/index.spec.js index 678301f28..8629db684 100644 --- a/modules/client/front/credit-insurance/index/index.spec.js +++ b/modules/client/front/credit-insurance/index/index.spec.js @@ -13,7 +13,7 @@ describe('Client', () => { $scope = $rootScope.$new(); const $element = angular.element(''); 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); }); }); }); diff --git a/modules/client/front/credit/create/index.spec.js b/modules/client/front/credit/create/index.spec.js index 2fda0af65..f8deb6911 100644 --- a/modules/client/front/credit/create/index.spec.js +++ b/modules/client/front/credit/create/index.spec.js @@ -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(''); 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(); diff --git a/modules/client/front/dms/create/index.spec.js b/modules/client/front/dms/create/index.spec.js index 5fa1a3835..fe302f7d2 100644 --- a/modules/client/front/dms/create/index.spec.js +++ b/modules/client/front/dms/create/index.spec.js @@ -15,7 +15,7 @@ describe('Client', () => { $httpParamSerializer = _$httpParamSerializer_; const $element = angular.element(''); 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); }); }); diff --git a/modules/client/front/dms/edit/index.spec.js b/modules/client/front/dms/edit/index.spec.js index d063db57d..155b1aba3 100644 --- a/modules/client/front/dms/edit/index.spec.js +++ b/modules/client/front/dms/edit/index.spec.js @@ -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); }); }); diff --git a/modules/client/front/fiscal-data/index.spec.js b/modules/client/front/fiscal-data/index.spec.js index 17e730914..609ba5121 100644 --- a/modules/client/front/fiscal-data/index.spec.js +++ b/modules/client/front/fiscal-data/index.spec.js @@ -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(''); 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); }); }); diff --git a/modules/client/front/index/index.spec.js b/modules/client/front/index/index.spec.js index 4fc2c4f8c..e37dccde4 100644 --- a/modules/client/front/index/index.spec.js +++ b/modules/client/front/index/index.spec.js @@ -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'); diff --git a/modules/client/front/postcode/city/index.spec.js b/modules/client/front/postcode/city/index.spec.js index c6cd8732f..18f93fe23 100644 --- a/modules/client/front/postcode/city/index.spec.js +++ b/modules/client/front/postcode/city/index.spec.js @@ -13,7 +13,7 @@ describe('Client', () => { $scope = $rootScope.$new(); const $element = angular.element(''); controller = $componentController('vnGeoCity', {$element, $scope}); - controller.client = {id: 101}; + controller.client = {id: 1101}; })); describe('onAccept()', () => { diff --git a/modules/client/front/postcode/index.spec.js b/modules/client/front/postcode/index.spec.js index 607866f44..497852324 100644 --- a/modules/client/front/postcode/index.spec.js +++ b/modules/client/front/postcode/index.spec.js @@ -13,7 +13,7 @@ describe('Client', () => { $scope = $rootScope.$new(); const $element = angular.element(''); controller = $componentController('vnGeoPostcode', {$element, $scope}); - controller.client = {id: 101}; + controller.client = {id: 1101}; })); describe('onAccept()', () => { diff --git a/modules/client/front/postcode/province/index.spec.js b/modules/client/front/postcode/province/index.spec.js index c28ecb489..de517570e 100644 --- a/modules/client/front/postcode/province/index.spec.js +++ b/modules/client/front/postcode/province/index.spec.js @@ -13,7 +13,7 @@ describe('Client', () => { $scope = $rootScope.$new(); const $element = angular.element(''); controller = $componentController('vnGeoProvince', {$element, $scope}); - controller.client = {id: 101}; + controller.client = {id: 1101}; })); describe('onAccept()', () => { diff --git a/modules/client/front/sample/create/index.spec.js b/modules/client/front/sample/create/index.spec.js index 37d322b5f..781025fd2 100644 --- a/modules/client/front/sample/create/index.spec.js +++ b/modules/client/front/sample/create/index.spec.js @@ -35,7 +35,7 @@ describe('Client', () => { show: () => {} }; $state = _$state_; - $state.params.id = 101; + $state.params.id = 1101; $httpBackend = _$httpBackend_; $httpParamSerializer = _$httpParamSerializer_; $element = angular.element(''); @@ -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 }; diff --git a/modules/client/front/sms/index.spec.js b/modules/client/front/sms/index.spec.js index 3462bf681..793c80d6e 100644 --- a/modules/client/front/sms/index.spec.js +++ b/modules/client/front/sms/index.spec.js @@ -13,8 +13,8 @@ describe('Client', () => { let $scope = $rootScope.$new(); $element = angular.element(''); 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'); diff --git a/modules/client/front/summary/index.spec.js b/modules/client/front/summary/index.spec.js index 397bb4240..04584cc1f 100644 --- a/modules/client/front/summary/index.spec.js +++ b/modules/client/front/summary/index.spec.js @@ -13,7 +13,7 @@ describe('Client', () => { $httpBackend = _$httpBackend_; const $element = angular.element(''); 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, diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js index cea61eaf9..7e34bb2a4 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/delete.spec.js @@ -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}, }; diff --git a/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js b/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js index 09f67eced..7dce9343c 100644 --- a/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js +++ b/modules/invoiceOut/back/methods/invoiceOut/specs/filter.spec.js @@ -20,7 +20,7 @@ describe('InvoiceOut filter()', () => { it('should return the invoice out matching clientFk', async() => { let ctx = { args: { - clientFk: 102, + clientFk: 1102, } }; diff --git a/modules/item/back/methods/item/specs/getBalance.spec.js b/modules/item/back/methods/item/specs/getBalance.spec.js index 671b8c103..601683471 100644 --- a/modules/item/back/methods/item/specs/getBalance.spec.js +++ b/modules/item/back/methods/item/specs/getBalance.spec.js @@ -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); diff --git a/modules/order/back/methods/order/specs/summary.spec.js b/modules/order/back/methods/order/specs/summary.spec.js index f6f917ede..f23ad570e 100644 --- a/modules/order/back/methods/order/specs/summary.spec.js +++ b/modules/order/back/methods/order/specs/summary.spec.js @@ -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() => { diff --git a/modules/order/front/create/card.spec.js b/modules/order/front/create/card.spec.js index 99e8c1f8a..e37900af6 100644 --- a/modules/order/front/create/card.spec.js +++ b/modules/order/front/create/card.spec.js @@ -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(); diff --git a/modules/order/front/prices-popover/index.spec.js b/modules/order/front/prices-popover/index.spec.js index 653682e52..d603b0fd4 100644 --- a/modules/order/front/prices-popover/index.spec.js +++ b/modules/order/front/prices-popover/index.spec.js @@ -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(); diff --git a/modules/ticket/back/methods/ticket-dms/specs/removeFile.spec.js b/modules/ticket/back/methods/ticket-dms/specs/removeFile.spec.js index b1cd5686a..1cd3b16cb 100644 --- a/modules/ticket/back/methods/ticket-dms/specs/removeFile.spec.js +++ b/modules/ticket/back/methods/ticket-dms/specs/removeFile.spec.js @@ -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; diff --git a/modules/ticket/back/methods/ticket-request/specs/filter.spec.js b/modules/ticket/back/methods/ticket-request/specs/filter.spec.js index 13636341c..82bdfbd38 100644 --- a/modules/ticket/back/methods/ticket-request/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket-request/specs/filter.spec.js @@ -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; diff --git a/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js b/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js index e600fbfa9..690fa669b 100644 --- a/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js +++ b/modules/ticket/back/methods/ticket-weekly/specs/filter.spec.js @@ -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'); }); }); diff --git a/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js b/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js index 1347af888..f8aa70dcc 100644 --- a/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js +++ b/modules/ticket/back/methods/ticket/specs/componentUpdate.spec.js @@ -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, diff --git a/modules/ticket/back/methods/ticket/specs/new.spec.js b/modules/ticket/back/methods/ticket/specs/new.spec.js index 7ffcab68e..d7d226295 100644 --- a/modules/ticket/back/methods/ticket/specs/new.spec.js +++ b/modules/ticket/back/methods/ticket/specs/new.spec.js @@ -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, diff --git a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js index 062be6b22..ffdee2a5a 100644 --- a/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js +++ b/modules/ticket/back/methods/ticket/specs/priceDifference.spec.js @@ -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; diff --git a/modules/ticket/back/methods/ticket/specs/restore.spec.js b/modules/ticket/back/methods/ticket/specs/restore.spec.js index 52135fc54..bd976d124 100644 --- a/modules/ticket/back/methods/ticket/specs/restore.spec.js +++ b/modules/ticket/back/methods/ticket/specs/restore.spec.js @@ -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}, diff --git a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js index 6bd265169..7d200a72d 100644 --- a/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js +++ b/modules/ticket/back/methods/ticket/specs/setDeleted.spec.js @@ -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}, }; diff --git a/modules/ticket/back/methods/ticket/specs/summary.spec.js b/modules/ticket/back/methods/ticket/specs/summary.spec.js index 0402c0a56..7d29e8258 100644 --- a/modules/ticket/back/methods/ticket/specs/summary.spec.js +++ b/modules/ticket/back/methods/ticket/specs/summary.spec.js @@ -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)); }); }); diff --git a/modules/ticket/back/methods/ticket/specs/transferSales.spec.js b/modules/ticket/back/methods/ticket/specs/transferSales.spec.js index 3d62ccce9..5a37abef4 100644 --- a/modules/ticket/back/methods/ticket/specs/transferSales.spec.js +++ b/modules/ticket/back/methods/ticket/specs/transferSales.spec.js @@ -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}, }; diff --git a/modules/ticket/back/methods/ticket/specs/uploadFile.spec.js b/modules/ticket/back/methods/ticket/specs/uploadFile.spec.js index 78b935ab5..4ad689411 100644 --- a/modules/ticket/back/methods/ticket/specs/uploadFile.spec.js +++ b/modules/ticket/back/methods/ticket/specs/uploadFile.spec.js @@ -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}}; diff --git a/modules/ticket/front/basic-data/step-one/index.spec.js b/modules/ticket/front/basic-data/step-one/index.spec.js index c7d09a7b1..2b14c18cc 100644 --- a/modules/ticket/front/basic-data/step-one/index.spec.js +++ b/modules/ticket/front/basic-data/step-one/index.spec.js @@ -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); diff --git a/modules/ticket/front/descriptor-menu/index.spec.js b/modules/ticket/front/descriptor-menu/index.spec.js index 6a3009daf..931f0be0d 100644 --- a/modules/ticket/front/descriptor-menu/index.spec.js +++ b/modules/ticket/front/descriptor-menu/index.spec.js @@ -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 }, diff --git a/modules/ticket/front/descriptor/index.spec.js b/modules/ticket/front/descriptor/index.spec.js index 608808448..292ab8d55 100644 --- a/modules/ticket/front/descriptor/index.spec.js +++ b/modules/ticket/front/descriptor/index.spec.js @@ -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 }, diff --git a/modules/ticket/front/dms/create/index.spec.js b/modules/ticket/front/dms/create/index.spec.js index 15017daf9..981839cd4 100644 --- a/modules/ticket/front/dms/create/index.spec.js +++ b/modules/ticket/front/dms/create/index.spec.js @@ -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 }; diff --git a/modules/ticket/front/dms/edit/index.spec.js b/modules/ticket/front/dms/edit/index.spec.js index 15ab588f7..d755dc150 100644 --- a/modules/ticket/front/dms/edit/index.spec.js +++ b/modules/ticket/front/dms/edit/index.spec.js @@ -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); }); }); diff --git a/modules/ticket/front/sale/index.spec.js b/modules/ticket/front/sale/index.spec.js index f49dc7452..7ddfda018 100644 --- a/modules/ticket/front/sale/index.spec.js +++ b/modules/ticket/front/sale/index.spec.js @@ -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); diff --git a/modules/ticket/front/sms/index.spec.js b/modules/ticket/front/sms/index.spec.js index 627643398..b133db04d 100644 --- a/modules/ticket/front/sms/index.spec.js +++ b/modules/ticket/front/sms/index.spec.js @@ -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'); diff --git a/modules/ticket/front/tracking/edit/index.spec.js b/modules/ticket/front/tracking/edit/index.spec.js index 8fc21309b..1ba5912b5 100644 --- a/modules/ticket/front/tracking/edit/index.spec.js +++ b/modules/ticket/front/tracking/edit/index.spec.js @@ -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'); diff --git a/modules/ticket/front/volume/index.spec.js b/modules/ticket/front/volume/index.spec.js index 8ffb1dfc1..5f6f433fb 100644 --- a/modules/ticket/front/volume/index.spec.js +++ b/modules/ticket/front/volume/index.spec.js @@ -18,7 +18,7 @@ describe('ticket', () => { }; }}; $state = _$state_; - $state.params.id = 101; + $state.params.id = 1101; const $element = angular.element(''); controller = $componentController('vnTicketVolume', {$element, $scope}); })); diff --git a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js index ab7d3aa1d..1990072f6 100644 --- a/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js +++ b/modules/travel/back/methods/travel/specs/cloneWithEntries.spec.js @@ -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; diff --git a/modules/travel/back/methods/travel/specs/createThermograph.spec.js b/modules/travel/back/methods/travel/specs/createThermograph.spec.js index b85dcca04..36221e479 100644 --- a/modules/travel/back/methods/travel/specs/createThermograph.spec.js +++ b/modules/travel/back/methods/travel/specs/createThermograph.spec.js @@ -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; diff --git a/modules/travel/back/methods/travel/specs/deleteThermograph.spec.js b/modules/travel/back/methods/travel/specs/deleteThermograph.spec.js index 843fa046c..215dd9a35 100644 --- a/modules/travel/back/methods/travel/specs/deleteThermograph.spec.js +++ b/modules/travel/back/methods/travel/specs/deleteThermograph.spec.js @@ -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; diff --git a/modules/worker/back/methods/calendar/specs/absences.spec.js b/modules/worker/back/methods/calendar/specs/absences.spec.js index 1b95bfdb6..cfe7379c3 100644 --- a/modules/worker/back/methods/calendar/specs/absences.spec.js +++ b/modules/worker/back/methods/calendar/specs/absences.spec.js @@ -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 diff --git a/modules/worker/back/methods/worker-dms/specs/downloadFile.spec.js b/modules/worker/back/methods/worker-dms/specs/downloadFile.spec.js index 27ed204ad..ac8e4539f 100644 --- a/modules/worker/back/methods/worker-dms/specs/downloadFile.spec.js +++ b/modules/worker/back/methods/worker-dms/specs/downloadFile.spec.js @@ -4,7 +4,7 @@ describe('worker-dms downloadFile()', () => { let dmsId = 4; it('should return a response for an employee with text content-type', async() => { - let workerId = 106; + let workerId = 1106; let ctx = {req: {accessToken: {userId: workerId}}}; const result = await app.models.WorkerDms.downloadFile(ctx, dmsId); diff --git a/modules/worker/back/methods/worker-dms/specs/removeFile.spec.js b/modules/worker/back/methods/worker-dms/specs/removeFile.spec.js index 7039d4f3e..3efd09464 100644 --- a/modules/worker/back/methods/worker-dms/specs/removeFile.spec.js +++ b/modules/worker/back/methods/worker-dms/specs/removeFile.spec.js @@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server'); describe('WorkerDms removeFile()', () => { const workerDmsFk = 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; diff --git a/modules/worker/back/methods/worker-time-control/specs/filter.spec.js b/modules/worker/back/methods/worker-time-control/specs/filter.spec.js index 913dfb355..7fe681ec1 100644 --- a/modules/worker/back/methods/worker-time-control/specs/filter.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/filter.spec.js @@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server'); describe('workerTimeControl filter()', () => { it('should return 1 result filtering by id', async() => { - let ctx = {req: {accessToken: {userId: 106}}, args: {workerFk: 106}}; + let ctx = {req: {accessToken: {userId: 1106}}, args: {workerFk: 1106}}; const firstHour = new Date(); firstHour.setHours(7, 0, 0, 0); const lastHour = new Date(); @@ -20,7 +20,7 @@ describe('workerTimeControl filter()', () => { }); it('should return a privilege error for a non subordinate worker', async() => { - let ctx = {req: {accessToken: {userId: 107}}, args: {workerFk: 106}}; + let ctx = {req: {accessToken: {userId: 1107}}, args: {workerFk: 1106}}; const firstHour = new Date(); firstHour.setHours(7, 0, 0, 0); const lastHour = new Date(); diff --git a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js index a50182f1b..5829653cc 100644 --- a/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js +++ b/modules/worker/back/methods/worker-time-control/specs/timeEntry.spec.js @@ -6,7 +6,7 @@ describe('workerTimeControl add/delete timeEntry()', () => { const HHRRId = 37; const teamBossId = 13; const employeeId = 1; - const salesPersonId = 106; + const salesPersonId = 1106; const salesBossId = 19; let activeCtx = { accessToken: {userId: 50}, diff --git a/modules/worker/back/methods/worker/specs/activeWithInheritedRole.spec.js b/modules/worker/back/methods/worker/specs/activeWithInheritedRole.spec.js index c44fb72f9..411cb8e57 100644 --- a/modules/worker/back/methods/worker/specs/activeWithInheritedRole.spec.js +++ b/modules/worker/back/methods/worker/specs/activeWithInheritedRole.spec.js @@ -1,6 +1,11 @@ const app = require('vn-loopback/server/server'); describe('Worker activeWithInheritedRole', () => { + let allRolesCount; + beforeAll(async() => { + allRolesCount = await app.models.Role.count(); + }); + it('should return the workers with an inherited role of salesPerson', async() => { const filter = {where: {role: 'salesPerson'}}; const result = await app.models.Worker.activeWithInheritedRole(filter); @@ -10,7 +15,8 @@ describe('Worker activeWithInheritedRole', () => { const isSalesPerson = await app.models.Account.hasRole(worker.id, 'salesPerson'); - expect(result.length).toEqual(19); + expect(result.length).toBeGreaterThan(1); + expect(result.length).toBeLessThan(allRolesCount); expect(isSalesPerson).toBe(true); }); @@ -23,7 +29,8 @@ describe('Worker activeWithInheritedRole', () => { const isBuyer = await app.models.Account.hasRole(worker.id, 'buyer'); - expect(result.length).toEqual(17); + expect(result.length).toBeGreaterThan(1); + expect(result.length).toBeLessThan(allRolesCount); expect(isBuyer).toBe(true); }); }); diff --git a/modules/worker/back/methods/worker/specs/deleteAbsence.spec.js b/modules/worker/back/methods/worker/specs/deleteAbsence.spec.js index 16036eac6..a105669cf 100644 --- a/modules/worker/back/methods/worker/specs/deleteAbsence.spec.js +++ b/modules/worker/back/methods/worker/specs/deleteAbsence.spec.js @@ -5,7 +5,7 @@ describe('Worker deleteAbsence()', () => { const businessId = 18; const workerId = 18; const activeCtx = { - accessToken: {userId: 106}, + accessToken: {userId: 1106}, headers: {origin: 'http://localhost'} }; const ctx = {req: activeCtx}; @@ -20,7 +20,7 @@ describe('Worker deleteAbsence()', () => { }); it('should return an error for a user without enough privileges', async() => { - activeCtx.accessToken.userId = 106; + activeCtx.accessToken.userId = 1106; const tx = await app.models.Calendar.beginTransaction({}); try { diff --git a/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js b/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js index 148b8467e..c06ff8502 100644 --- a/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js +++ b/modules/worker/back/methods/worker/specs/getWorkedHours.spec.js @@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server'); describe('Worker getWorkedHours()', () => { it(`should return the expected hours and the worked hours of a given date`, async() => { - const workerID = 106; + const workerID = 1106; let started = new Date(); started.setHours(0, 0, 0, 0); diff --git a/modules/worker/back/methods/worker/specs/holidays.spec.js b/modules/worker/back/methods/worker/specs/holidays.spec.js index 6f588147c..317bc8f0f 100644 --- a/modules/worker/back/methods/worker/specs/holidays.spec.js +++ b/modules/worker/back/methods/worker/specs/holidays.spec.js @@ -2,8 +2,8 @@ const app = require('vn-loopback/server/server'); const LoopBackContext = require('loopback-context'); describe('Worker holidays()', () => { - const businessId = 106; - const workerId = 106; + const businessId = 1106; + const workerId = 1106; const activeCtx = { accessToken: {userId: workerId}, headers: {origin: 'http://localhost'} @@ -16,7 +16,7 @@ describe('Worker holidays()', () => { }); }); - it('should get the absence calendar for a full year contract', async() => { + it('should now get the absence calendar for a full year contract', async() => { const now = new Date(); const year = now.getFullYear(); diff --git a/modules/worker/back/methods/worker/specs/isSubordinate.spec.js b/modules/worker/back/methods/worker/specs/isSubordinate.spec.js index 53a620fcc..ea6738f8b 100644 --- a/modules/worker/back/methods/worker/specs/isSubordinate.spec.js +++ b/modules/worker/back/methods/worker/specs/isSubordinate.spec.js @@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server'); describe('worker isSubordinate()', () => { it('should return truthy if a worker is a subordinate', async() => { let ctx = {req: {accessToken: {userId: 19}}}; - let workerFk = 106; + let workerFk = 1106; let result = await app.models.Worker.isSubordinate(ctx, workerFk); expect(result).toBeTruthy(); @@ -11,15 +11,15 @@ describe('worker isSubordinate()', () => { it('should return truthy for an hr person', async() => { let ctx = {req: {accessToken: {userId: 37}}}; - let workerFk = 106; + let workerFk = 1106; let result = await app.models.Worker.isSubordinate(ctx, workerFk); expect(result).toBeTruthy(); }); it('should return truthy if the current user is himself', async() => { - let ctx = {req: {accessToken: {userId: 106}}}; - let workerFk = 106; + let ctx = {req: {accessToken: {userId: 1106}}}; + let workerFk = 1106; let result = await app.models.Worker.isSubordinate(ctx, workerFk); expect(result).toBeTruthy(); diff --git a/modules/worker/back/methods/worker/specs/mySubordinates.spec.js b/modules/worker/back/methods/worker/specs/mySubordinates.spec.js index 5a458a1bc..7eb118d9c 100644 --- a/modules/worker/back/methods/worker/specs/mySubordinates.spec.js +++ b/modules/worker/back/methods/worker/specs/mySubordinates.spec.js @@ -9,9 +9,9 @@ describe('worker mySubordinates()', () => { }); it('should return an array of one subordinate', async() => { - let ctx = {req: {accessToken: {userId: 106}}}; + const workerFk = 1106; + let ctx = {req: {accessToken: {userId: workerFk}}}; let result = await app.models.Worker.mySubordinates(ctx); - const workerFk = 106; expect(result.length).toEqual(1); expect(result[0].workerFk).toEqual(workerFk); diff --git a/modules/worker/back/methods/worker/specs/updateAbsence.spec.js b/modules/worker/back/methods/worker/specs/updateAbsence.spec.js index 2ff8e64e1..6339b3163 100644 --- a/modules/worker/back/methods/worker/specs/updateAbsence.spec.js +++ b/modules/worker/back/methods/worker/specs/updateAbsence.spec.js @@ -2,10 +2,10 @@ const app = require('vn-loopback/server/server'); const LoopBackContext = require('loopback-context'); describe('Worker updateAbsence()', () => { - const workerId = 106; - const businessId = 106; + const workerId = 1106; + const businessId = 1106; const activeCtx = { - accessToken: {userId: 106}, + accessToken: {userId: 1106}, headers: {origin: 'http://localhost'} }; const ctx = {req: activeCtx}; @@ -30,7 +30,7 @@ describe('Worker updateAbsence()', () => { }); it('should return an error for a user without enough privileges', async() => { - activeCtx.accessToken.userId = 106; + activeCtx.accessToken.userId = 1106; const expectedAbsenceTypeId = 2; let error; diff --git a/modules/worker/back/methods/worker/specs/uploadFile.spec.js b/modules/worker/back/methods/worker/specs/uploadFile.spec.js index 26a50252d..7a929cd2b 100644 --- a/modules/worker/back/methods/worker/specs/uploadFile.spec.js +++ b/modules/worker/back/methods/worker/specs/uploadFile.spec.js @@ -2,8 +2,8 @@ const app = require('vn-loopback/server/server'); describe('Worker uploadFile()', () => { it(`should return an error for a user without enough privileges`, async() => { - let workerId = 106; - let currentUserId = 102; + let workerId = 1106; + let currentUserId = 1102; let hhrrDataId = 3; let ctx = {req: {accessToken: {userId: currentUserId}}, args: {dmsTypeId: hhrrDataId}}; diff --git a/modules/worker/front/calendar/index.spec.js b/modules/worker/front/calendar/index.spec.js index 141bf6653..e8f9b3130 100644 --- a/modules/worker/front/calendar/index.spec.js +++ b/modules/worker/front/calendar/index.spec.js @@ -18,8 +18,8 @@ describe('Worker', () => { controller = $componentController('vnWorkerCalendar', {$element, $scope}); controller.isSubordinate = true; controller.absenceType = {id: 1, name: 'Holiday', code: 'holiday', rgb: 'red'}; - controller.$params.id = 106; - controller._worker = {id: 106}; + controller.$params.id = 1106; + controller._worker = {id: 1106}; })); describe('year() getter', () => { @@ -45,7 +45,7 @@ describe('Worker', () => { it(`should set the contract id and then call to the refresh method`, () => { jest.spyOn(controller, 'refresh').mockReturnValue(Promise.resolve()); - controller.businessId = 106; + controller.businessId = 1106; expect(controller.refresh).toHaveBeenCalledWith(); }); @@ -74,7 +74,7 @@ describe('Worker', () => { let yesterday = new Date(today.getTime()); yesterday.setDate(yesterday.getDate() - 1); - controller.worker = {id: 107}; + controller.worker = {id: 1107}; expect(controller.getIsSubordinate).toHaveBeenCalledWith(); expect(controller.getActiveContract).toHaveBeenCalledWith(); @@ -83,7 +83,7 @@ describe('Worker', () => { describe('getIsSubordinate()', () => { it(`should return whether the worker is a subordinate`, () => { - $httpBackend.expect('GET', `Workers/106/isSubordinate`).respond(true); + $httpBackend.expect('GET', `Workers/1106/isSubordinate`).respond(true); controller.getIsSubordinate(); $httpBackend.flush(); @@ -95,11 +95,11 @@ describe('Worker', () => { it(`should return the current contract and then set the businessId property`, () => { jest.spyOn(controller, 'refresh').mockReturnValue(Promise.resolve()); - $httpBackend.expect('GET', `Workers/106/activeContract`).respond({businessFk: 106}); + $httpBackend.expect('GET', `Workers/1106/activeContract`).respond({businessFk: 1106}); controller.getActiveContract(); $httpBackend.flush(); - expect(controller.businessId).toEqual(106); + expect(controller.businessId).toEqual(1106); }); }); @@ -109,7 +109,7 @@ describe('Worker', () => { const year = today.getFullYear(); const serializedParams = $httpParamSerializer({year}); - $httpBackend.expect('GET', `Workers/106/holidays?${serializedParams}`).respond({totalHolidays: 28}); + $httpBackend.expect('GET', `Workers/1106/holidays?${serializedParams}`).respond({totalHolidays: 28}); controller.getContractHolidays(); $httpBackend.flush(); @@ -240,7 +240,7 @@ describe('Worker', () => { const calendarElement = {}; const expectedResponse = {id: 10}; - $httpBackend.expect('POST', `Workers/106/createAbsence`).respond(200, expectedResponse); + $httpBackend.expect('POST', `Workers/1106/createAbsence`).respond(200, expectedResponse); controller.create(calendarElement, dated); $httpBackend.flush(); @@ -268,7 +268,7 @@ describe('Worker', () => { controller.absenceType = newAbsenceType; const expectedParams = {absenceId: 10, absenceTypeId: 2}; - $httpBackend.expect('PATCH', `Workers/106/updateAbsence`, expectedParams).respond(200); + $httpBackend.expect('PATCH', `Workers/1106/updateAbsence`, expectedParams).respond(200); controller.edit(calendarElement, event); $httpBackend.flush(); @@ -295,7 +295,7 @@ describe('Worker', () => { controller.events[selectedDay.getTime()] = expectedEvent; const serializedParams = $httpParamSerializer(expectedParams); - $httpBackend.expect('DELETE', `Workers/106/deleteAbsence?${serializedParams}`).respond(200); + $httpBackend.expect('DELETE', `Workers/1106/deleteAbsence?${serializedParams}`).respond(200); controller.delete(calendarElement, selectedDay, expectedEvent); $httpBackend.flush(); diff --git a/modules/worker/front/dms/create/index.spec.js b/modules/worker/front/dms/create/index.spec.js index 07a66b9dc..b1c803854 100644 --- a/modules/worker/front/dms/create/index.spec.js +++ b/modules/worker/front/dms/create/index.spec.js @@ -16,7 +16,7 @@ describe('Client', () => { $httpParamSerializer = _$httpParamSerializer_; $element = $compile(``)($rootScope); controller = $element.controller('vnWorkerDmsCreate'); - controller._worker = {id: 101, name: 'Bruce wayne'}; + controller._worker = {id: 1101, name: 'Bruce wayne'}; })); describe('worker() setter', () => { @@ -46,7 +46,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); }); }); diff --git a/modules/worker/front/dms/edit/index.spec.js b/modules/worker/front/dms/edit/index.spec.js index 44abc6d64..0b69f2894 100644 --- a/modules/worker/front/dms/edit/index.spec.js +++ b/modules/worker/front/dms/edit/index.spec.js @@ -14,7 +14,7 @@ describe('Worker', () => { $httpBackend = _$httpBackend_; $element = angular.element(` { jest.spyOn(controller, 'getAllowedContentTypes'); controller._worker = undefined; controller.worker = { - id: 106 + id: 1106 }; expect(controller.setDefaultParams).toHaveBeenCalledWith(); @@ -37,7 +37,7 @@ describe('Worker', () => { it('should perform a GET query and define the dms property on controller', () => { const dmsId = 4; const expectedResponse = { - reference: 101, + reference: 1101, warehouseFk: 1, companyFk: 442, dmsTypeFk: 3, @@ -51,7 +51,7 @@ describe('Worker', () => { $httpBackend.flush(); expect(controller.dms).toBeDefined(); - expect(controller.dms.reference).toEqual(101); + expect(controller.dms.reference).toEqual(1101); expect(controller.dms.dmsTypeId).toEqual(3); }); }); diff --git a/modules/zone/back/methods/agency/specs/getAgenciesWithWarehouse.spec.js b/modules/zone/back/methods/agency/specs/getAgenciesWithWarehouse.spec.js index a547c7b45..bc7aa1ed9 100644 --- a/modules/zone/back/methods/agency/specs/getAgenciesWithWarehouse.spec.js +++ b/modules/zone/back/methods/agency/specs/getAgenciesWithWarehouse.spec.js @@ -8,7 +8,8 @@ describe('Agency getAgenciesWithWarehouse()', () => { try { const options = {transaction: tx}; - const agencies = await app.models.Agency.getAgenciesWithWarehouse(101, today, 1, options); + const addressId = 101; + const agencies = await app.models.Agency.getAgenciesWithWarehouse(addressId, today, 1, options); expect(agencies.length).toEqual(3); expect(agencies[0].agencyMode).toEqual('inhouse pickup'); @@ -28,7 +29,8 @@ describe('Agency getAgenciesWithWarehouse()', () => { try { const options = {transaction: tx}; - const agencies = await app.models.Agency.getAgenciesWithWarehouse(101, null, 1, options); + const addressId = 101; + const agencies = await app.models.Agency.getAgenciesWithWarehouse(addressId, null, 1, options); expect(agencies.length).toEqual(0);