test buyUltimateFromInterval arreglado
This commit is contained in:
parent
136d1ef05f
commit
1301ea5962
|
@ -5,25 +5,14 @@ describe('buyUltimateFromInterval()', () => {
|
||||||
let today;
|
let today;
|
||||||
let future;
|
let future;
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
let date = new Date();
|
let now = new Date();
|
||||||
let month = `${date.getMonth() + 1}`;
|
now.setHours(0, 0, 0, 0);
|
||||||
let futureMonth = `${date.getMonth() + 2}`;
|
today = now;
|
||||||
let day = date.getDate();
|
|
||||||
let year = date.getFullYear();
|
|
||||||
let futureYear = year;
|
|
||||||
|
|
||||||
if (month.toString().length < 2) month = '0' + month;
|
let futureDate = new Date(now);
|
||||||
if (futureMonth.toString().length < 2) futureMonth = '0' + futureMonth;
|
let futureMonth = now.getMonth() + 1;
|
||||||
if (futureMonth.toString() == '13') {
|
futureDate.setMonth(futureMonth);
|
||||||
futureMonth = '01';
|
future = futureDate;
|
||||||
futureYear + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (day.toString().length < 2) day = `0${day}`;
|
|
||||||
|
|
||||||
today = [year, month, 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() => {
|
||||||
|
@ -65,8 +54,8 @@ describe('buyUltimateFromInterval()', () => {
|
||||||
expect(buyUltimateFromIntervalTable[0].buyFk).toEqual(3);
|
expect(buyUltimateFromIntervalTable[0].buyFk).toEqual(3);
|
||||||
expect(buyUltimateFromIntervalTable[1].buyFk).toEqual(5);
|
expect(buyUltimateFromIntervalTable[1].buyFk).toEqual(5);
|
||||||
|
|
||||||
expect(buyUltimateFromIntervalTable[0].landed).toEqual(new Date(today));
|
expect(buyUltimateFromIntervalTable[0].landed).toEqual(today);
|
||||||
expect(buyUltimateFromIntervalTable[1].landed).toEqual(new Date(today));
|
expect(buyUltimateFromIntervalTable[1].landed).toEqual(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() => {
|
||||||
|
@ -101,8 +90,8 @@ describe('buyUltimateFromInterval()', () => {
|
||||||
expect(buyUltimateFromIntervalTable[0].buyFk).toEqual(3);
|
expect(buyUltimateFromIntervalTable[0].buyFk).toEqual(3);
|
||||||
expect(buyUltimateFromIntervalTable[1].buyFk).toEqual(5);
|
expect(buyUltimateFromIntervalTable[1].buyFk).toEqual(5);
|
||||||
|
|
||||||
expect(buyUltimateFromIntervalTable[0].landed).toEqual(new Date(today));
|
expect(buyUltimateFromIntervalTable[0].landed).toEqual(today);
|
||||||
expect(buyUltimateFromIntervalTable[1].landed).toEqual(new Date(today));
|
expect(buyUltimateFromIntervalTable[1].landed).toEqual(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() => {
|
||||||
|
@ -137,7 +126,7 @@ describe('buyUltimateFromInterval()', () => {
|
||||||
expect(buyUltimateFromIntervalTable[0].buyFk).toEqual(3);
|
expect(buyUltimateFromIntervalTable[0].buyFk).toEqual(3);
|
||||||
expect(buyUltimateFromIntervalTable[1].buyFk).toEqual(5);
|
expect(buyUltimateFromIntervalTable[1].buyFk).toEqual(5);
|
||||||
|
|
||||||
expect(buyUltimateFromIntervalTable[0].landed).toEqual(new Date(today));
|
expect(buyUltimateFromIntervalTable[0].landed).toEqual(today);
|
||||||
expect(buyUltimateFromIntervalTable[1].landed).toEqual(new Date(today));
|
expect(buyUltimateFromIntervalTable[1].landed).toEqual(today);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue