Skip to content

Commit 9b129b8

Browse files
author
Edgar Guaman
committed
fix: TT-336 Changes in time entries unit tests
1 parent 97c04d6 commit 9b129b8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/app/modules/reports/components/time-entries-table/time-entries-table.component.spec.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { RouterLinkWithHref } from '@angular/router';
23
import { MockStore, provideMockStore } from '@ngrx/store/testing';
34
import { Entry } from 'src/app/modules/shared/models';
45
import { SubstractDatePipe } from 'src/app/modules/shared/pipes/substract-date/substract-date.pipe';
@@ -13,6 +14,9 @@ describe('Reports Page', () => {
1314
let store: MockStore<EntryState>;
1415
let getReportDataSourceSelectorMock;
1516
let durationTime: number;
17+
let row: number;
18+
let node: number;
19+
let decimalValidator: RegExp;
1620
const timeEntry: Entry = {
1721
id: '123',
1822
start_date: new Date(),
@@ -65,6 +69,9 @@ describe('Reports Page', () => {
6569

6670
beforeEach(() => {
6771
durationTime = new Date().setHours(5, 30);
72+
row = 0;
73+
node = 0;
74+
decimalValidator = /^\d+\.\d{0,2}$/;
6875
});
6976

7077
it('component should be created', async () => {
@@ -113,11 +120,14 @@ describe('Reports Page', () => {
113120
});
114121

115122
it('The data should be displayed as a multiple of hour when column is equal to 3', () => {
116-
expect(component.bodyExportOptions(durationTime, 0, 3, 0)).toMatch(/^\d+\.\d{0,2}$/);
123+
const column = 3;
124+
125+
expect(component.bodyExportOptions(durationTime, row, column, node)).toMatch(decimalValidator);
117126
});
118127

119128
it('The data should not be displayed as a multiple of hour when column is different of 3', () => {
120-
expect(component.bodyExportOptions(durationTime, 0, 4, 0)).toBe(durationTime);
129+
const column = 4;
130+
expect(component.bodyExportOptions(durationTime, row, column, node)).toBe(durationTime);
121131
});
122132

123133
afterEach(() => {

0 commit comments

Comments
 (0)