Skip to content
Prev Previous commit
fix: TTA-196 fixed tests for 2 fixed point digits. TODO: use that con…
…stant in tests
  • Loading branch information
mmaquina committed Oct 28, 2022
commit 2952053a4b2d33a42f622aed82a235b9e27a5b9e
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ describe('SubstractDatePipeDisplayAsFloat', () => {
expect(pipe).toBeTruthy();
});

it('returns the date diff as float hours (xx.x)', () => {
/*TODO: tests will be more robust if they take into account FIXED_POINT_DIGITS*/
it('returns the date diff as float hours (xx.xx)', () => {
[
{ endDate: '2021-04-11T10:20:00Z', startDate: '2021-04-11T08:00:00Z', expectedDiff: '2.3' },
{ endDate: '2021-04-11T17:40:00Z', startDate: '2021-04-11T17:10:00Z', expectedDiff: '0.5' },
{ endDate: '2021-04-11T18:18:00Z', startDate: '2021-04-11T18:00:00Z', expectedDiff: '0.3' },
{ endDate: '2021-04-12T12:18:00Z', startDate: '2021-04-11T10:00:00Z', expectedDiff: '26.3' },
{ endDate: '2021-04-12T10:01:00Z', startDate: '2021-04-12T10:00:00Z', expectedDiff: '0.0' },
{ endDate: '2021-04-11T11:27:00Z', startDate: '2021-04-11T10:03:45Z', expectedDiff: '1.4' },
{ endDate: '2021-04-11T10:20:00Z', startDate: '2021-04-11T08:00:00Z', expectedDiff: '2.33' },
{ endDate: '2021-04-11T17:40:00Z', startDate: '2021-04-11T17:10:00Z', expectedDiff: '0.50' },
{ endDate: '2021-04-11T18:18:00Z', startDate: '2021-04-11T18:00:00Z', expectedDiff: '0.30' },
{ endDate: '2021-04-12T12:18:00Z', startDate: '2021-04-11T10:00:00Z', expectedDiff: '26.30' },
{ endDate: '2021-04-12T10:01:00Z', startDate: '2021-04-12T10:00:00Z', expectedDiff: '0.02' },
{ endDate: '2021-04-11T11:27:00Z', startDate: '2021-04-11T10:03:45Z', expectedDiff: '1.39' },
].forEach(({ startDate, endDate, expectedDiff }) => {
const fromDate = new Date(endDate);
const substractDate = new Date(startDate);
Expand Down