test fixes
This commit is contained in:
parent
b1f0367b34
commit
535d98f485
|
@ -9,7 +9,7 @@ let verbose = false;
|
|||
if (process.argv[2] === '--v')
|
||||
verbose = true;
|
||||
|
||||
serviceRoot = `${__dirname}/services/db`;
|
||||
loopbackApp = `${__dirname}/loopback/server/server`;
|
||||
|
||||
let Jasmine = require('jasmine');
|
||||
let jasmine = new Jasmine();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const app = require(`${serviceRoot}/server/server`);
|
||||
const app = require(`${loopbackApp}`);
|
||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
|
||||
describe('last_buy_refresh()', () => {
|
||||
it(`should store some data on cache.last_buy`, async () => {
|
||||
it(`should store some data on cache.last_buy`, async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
const app = require(`${serviceRoot}/server/server`);
|
||||
const app = require(`${loopbackApp}`);
|
||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
|
||||
describe('buyUltimate()', () => {
|
||||
const today = new Date();
|
||||
it(`should create buyUltimate temporal table and update it's values`, async () => {
|
||||
it(`should create buyUltimate temporal table and update it's values`, async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const app = require(`${serviceRoot}/server/server`);
|
||||
const app = require(`${loopbackApp}`);
|
||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
|
||||
describe('buyUltimateFromInterval()', () => {
|
||||
|
@ -10,16 +10,23 @@ describe('buyUltimateFromInterval()', () => {
|
|||
let futureMonth = `${date.getMonth() + 2}`;
|
||||
let day = date.getDate();
|
||||
let year = date.getFullYear();
|
||||
let futureYear = year;
|
||||
|
||||
if (month.toString().length < 2) month = '0' + month;
|
||||
if (futureMonth.toString().length < 2) month = '0' + month;
|
||||
if (futureMonth.toString().length < 2) futureMonth = '0' + futureMonth;
|
||||
if (futureMonth.toString() == '13') {
|
||||
futureMonth = '01';
|
||||
futureYear + 1;
|
||||
}
|
||||
|
||||
|
||||
if (day.toString().length < 2) day = `0${day}`;
|
||||
|
||||
today = [year, month, day].join('-');
|
||||
future = [year, futureMonth, day].join('-');
|
||||
future = [futureYear, futureMonth, day].join('-');
|
||||
});
|
||||
|
||||
it(`should create a temporal table with it's data`, async () => {
|
||||
it(`should create a temporal table with it's data`, async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
@ -58,11 +65,11 @@ describe('buyUltimateFromInterval()', () => {
|
|||
expect(buyUltimateFromIntervalTable[0].buyFk).toEqual(3);
|
||||
expect(buyUltimateFromIntervalTable[1].buyFk).toEqual(5);
|
||||
|
||||
expect(buyUltimateFromIntervalTable[0].landed).toEqual(today);
|
||||
expect(buyUltimateFromIntervalTable[1].landed).toEqual(today);
|
||||
expect(buyUltimateFromIntervalTable[0].landed).toEqual(new Date(today));
|
||||
expect(buyUltimateFromIntervalTable[1].landed).toEqual(new Date(today));
|
||||
});
|
||||
|
||||
it(`should create a temporal table with it's data in which started value is assigned to ended`, async () => {
|
||||
it(`should create a temporal table with it's data in which started value is assigned to ended`, async() => {
|
||||
let params = {
|
||||
warehouseFk: 1,
|
||||
started: today,
|
||||
|
@ -94,11 +101,11 @@ describe('buyUltimateFromInterval()', () => {
|
|||
expect(buyUltimateFromIntervalTable[0].buyFk).toEqual(3);
|
||||
expect(buyUltimateFromIntervalTable[1].buyFk).toEqual(5);
|
||||
|
||||
expect(buyUltimateFromIntervalTable[0].landed).toEqual(today);
|
||||
expect(buyUltimateFromIntervalTable[1].landed).toEqual(today);
|
||||
expect(buyUltimateFromIntervalTable[0].landed).toEqual(new Date(today));
|
||||
expect(buyUltimateFromIntervalTable[1].landed).toEqual(new Date(today));
|
||||
});
|
||||
|
||||
it(`should create a temporal table with it's data in which ended value is a date in the future`, async () => {
|
||||
it(`should create a temporal table with it's data in which ended value is a date in the future`, async() => {
|
||||
let params = {
|
||||
warehouseFk: 1,
|
||||
started: today,
|
||||
|
@ -130,7 +137,7 @@ describe('buyUltimateFromInterval()', () => {
|
|||
expect(buyUltimateFromIntervalTable[0].buyFk).toEqual(3);
|
||||
expect(buyUltimateFromIntervalTable[1].buyFk).toEqual(5);
|
||||
|
||||
expect(buyUltimateFromIntervalTable[0].landed).toEqual(today);
|
||||
expect(buyUltimateFromIntervalTable[1].landed).toEqual(today);
|
||||
expect(buyUltimateFromIntervalTable[0].landed).toEqual(new Date(today));
|
||||
expect(buyUltimateFromIntervalTable[1].landed).toEqual(new Date(today));
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const app = require(`${serviceRoot}/server/server`);
|
||||
const app = require(`${loopbackApp}`);
|
||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
|
||||
describe('logAddWithUser()', () => {
|
||||
it('should log any action taken by the user in a table ending in Log', async () => {
|
||||
it('should log any action taken by the user in a table ending in Log', async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
const app = require(`${serviceRoot}/server/server`);
|
||||
const app = require(`${loopbackApp}`);
|
||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
|
||||
describe('ticket ticketCalculateClon()', () => {
|
||||
const today = new Date();
|
||||
it('should add the ticket to the order containing the original ticket', async () => {
|
||||
it('should add the ticket to the order containing the original ticket', async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
@ -56,7 +56,7 @@ describe('ticket ticketCalculateClon()', () => {
|
|||
expect(result[angencyHourIndex][0].landed).toBeDefined();
|
||||
});
|
||||
|
||||
it('should add the ticket to the order containing the original ticket and generate landed value if it was null', async () => {
|
||||
it('should add the ticket to the order containing the original ticket and generate landed value if it was null', async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const app = require(`${serviceRoot}/server/server`);
|
||||
const app = require(`${loopbackApp}`);
|
||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
|
||||
describe('ticketComponentUpdateSale()', () => {
|
||||
it(`should update the sale price when option ONE using the base components and reclaculate only the ones with isRenewable TRUE`, async () => {
|
||||
it(`should update the sale price when option ONE using the base components and reclaculate only the ones with isRenewable TRUE`, async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
@ -95,7 +95,7 @@ describe('ticketComponentUpdateSale()', () => {
|
|||
expect(result[firstSalePriceIndexAfter][0].price).toEqual(5);
|
||||
});
|
||||
|
||||
it(`should keep the sale price when option TWO using the base components and save the difference in a new component`, async () => {
|
||||
it(`should keep the sale price when option TWO using the base components and save the difference in a new component`, async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
@ -189,7 +189,7 @@ describe('ticketComponentUpdateSale()', () => {
|
|||
expect(result[firstSalePriceIndexBefore][0].price).toEqual(result[firstSalePriceIndexAfter][0].price);
|
||||
});
|
||||
|
||||
it(`should not change the sale price when option SEVEN, instead it stores 80% and 20% of the price in two components and any price difference in a third one`, async () => {
|
||||
it(`should not change the sale price when option SEVEN, instead it stores 80% and 20% of the price in two components and any price difference in a third one`, async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
const app = require(`${serviceRoot}/server/server`);
|
||||
const app = require(`${loopbackApp}`);
|
||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
|
||||
describe('ticket ticketCreateWithUser()', () => {
|
||||
const today = new Date();
|
||||
it('should confirm the procedure creates the expected ticket', async () => {
|
||||
it('should confirm the procedure creates the expected ticket', async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
@ -53,7 +53,7 @@ describe('ticket ticketCreateWithUser()', () => {
|
|||
expect(ticketResult.routeFk).toEqual(params.routeFk);
|
||||
});
|
||||
|
||||
it('should confirm the procedure creates the expected observations in the ticket', async () => {
|
||||
it('should confirm the procedure creates the expected observations in the ticket', async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
@ -104,7 +104,7 @@ describe('ticket ticketCreateWithUser()', () => {
|
|||
expect(thirdTicketObservation.description).toEqual('care with the dog');
|
||||
});
|
||||
|
||||
it('should confirm the procedure sets companyFk as Tenerife if vProvinceName is SANTA CRUZ DE TENERIFE', async () => {
|
||||
it('should confirm the procedure sets companyFk as Tenerife if vProvinceName is SANTA CRUZ DE TENERIFE', async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
@ -154,7 +154,7 @@ describe('ticket ticketCreateWithUser()', () => {
|
|||
expect(ticket.companyFk).toEqual(tenerife);
|
||||
});
|
||||
|
||||
it('should confirm the procedure sets address if it received it null', async () => {
|
||||
it('should confirm the procedure sets address if it received it null', async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
@ -203,7 +203,7 @@ describe('ticket ticketCreateWithUser()', () => {
|
|||
expect(ticketAddress.addressFk).toEqual(clientDefaultAddress.id);
|
||||
});
|
||||
|
||||
it('should confirm the procedure creates the state as delivered if the client has isCreatedAsServed TRUE', async () => {
|
||||
it('should confirm the procedure creates the state as delivered if the client has isCreatedAsServed TRUE', async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
||||
|
|
Loading…
Reference in New Issue