Skip to content

Commit fafe5bc

Browse files
committed
test: TT-33 include ticket changes in tests
1 parent c6ea937 commit fafe5bc

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

src/app/modules/reports/components/time-range-form/time-range-form.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import * as entryActions from '../../../time-clock/store/entry.actions';
77
import {Store} from '@ngrx/store';
88
import {EntryState} from '../../../time-clock/store/entry.reducer';
99
import * as moment from 'moment';
10+
import { DateAdapter } from '@angular/material/core';
11+
1012

1113

1214
@Component({
@@ -21,11 +23,13 @@ export class TimeRangeFormComponent implements OnInit, OnChanges {
2123
private startDate = new FormControl('');
2224
private endDate = new FormControl('');
2325

24-
constructor(private store: Store<EntryState>, private toastrService: ToastrService) {
26+
constructor(private store: Store<EntryState>, private toastrService: ToastrService, private date: DateAdapter<Date>) {
2527
this.reportForm = new FormGroup({
2628
startDate: this.startDate,
2729
endDate: this.endDate
2830
});
31+
date.getFirstDayOfWeek = () => 1;
32+
2933
}
3034
ngOnInit(): void {
3135
this.setInitialDataOnScreen();

src/app/modules/reports/components/time-range-form/time-range.component.spec.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ import { InputDateComponent } from '../../../shared/components/input-date/input-
88
import * as entryActions from '../../../time-clock/store/entry.actions';
99
import * as moment from 'moment';
1010
import { SimpleChange } from '@angular/core';
11+
import { DateAdapter } from '@angular/material/core';
12+
1113

1214
describe('Reports Page', () => {
1315
describe('TimeRangeFormComponent', () => {
1416
let component: TimeRangeFormComponent;
1517
let fixture: ComponentFixture<TimeRangeFormComponent>;
1618
let store: MockStore<EntryState>;
19+
let date: DateAdapter<Date>;
20+
1721
const toastrServiceStub = {
1822
error: (message?: string, title?: string, override?: Partial<IndividualConfig>) => { }
1923
};
@@ -46,10 +50,12 @@ describe('Reports Page', () => {
4650
declarations: [TimeRangeFormComponent, InputDateComponent],
4751
providers: [
4852
provideMockStore({ initialState: state }),
49-
{ provide: ToastrService, useValue: toastrServiceStub }
53+
{ provide: ToastrService, useValue: toastrServiceStub },
54+
{ provide: DateAdapter, useClass: DateAdapter }
5055
],
5156
}).compileComponents();
5257
store = TestBed.inject(MockStore);
58+
date = TestBed.inject(DateAdapter);
5359

5460
}));
5561

src/app/modules/shared/components/input-date/input-date.component.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ export class InputDateComponent implements ControlValueAccessor {
2323
onChange = (_: any) => { };
2424
onTouch = () => { };
2525

26-
constructor(date: DateAdapter<Date>) {
27-
date.getFirstDayOfWeek = () => 1;
28-
}
29-
30-
onInput(value: moment.Moment) {
26+
onInput(value: moment.Moment, date: DateAdapter<Date>) {
3127
this.value = value.format(DATE_FORMAT_YEAR);
3228
this.onTouch();
3329
this.onChange(this.value);

src/environments/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
export const environment = {
66
production: false,
7-
timeTrackerApiUrl: 'http://localhost:7071/api',
7+
timeTrackerApiUrl: 'https://0390-2800-4f0-546-4680-b5ef-416e-decc-9774.ngrok.io/api',
88
stackexchangeApiUrl: 'https://api.stackexchange.com',
99
};
1010

0 commit comments

Comments
 (0)