Skip to content
Prev Previous commit
Next Next commit
fixed test
  • Loading branch information
daros10 committed Mar 19, 2020
commit 78032909809c384983712317b99bf4602075e4d5
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ describe('TimeClockComponent', () => {
expect(component).toBeTruthy();
});

it('should have p tag as \'Dario clocked out at hh:mm:ss\'', async(() => {
it('should have p tag as \'Dario clocked out at 00:00:00\'', async(() => {
// tslint:disable-next-line: no-shadowed-variable
const { app, fixture } = setup();
fixture.detectChanges();
const compile = fixture.debugElement.nativeElement;
const ptag = compile.querySelector('p');
expect(ptag.textContent).toBe('Dario clocked out at hh:mm:ss');
expect(ptag.textContent).toBe('Dario clocked out at 00:00:00');
}));

it('should set showfileds as true', () => {
Expand Down
14 changes: 9 additions & 5 deletions src/app/components/shared/clock/clock.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ describe('ClockComponent', () => {
let component: ClockComponent;
let fixture: ComponentFixture<ClockComponent>;


beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ClockComponent ]
Expand All @@ -25,13 +24,18 @@ describe('ClockComponent', () => {
});

it('should show the current hour of day', () => {
const currentHour = 11;
expect(component.currentDate.getHours()).toEqual(currentHour);
const currentDate: Date = new Date();
expect(component.currentDate.getHours()).toEqual(currentDate.getHours());
});

it('should show the current minutes of day', () => {
const currenMinutes = 5;
expect(component.currentDate.getMinutes()).toEqual(currenMinutes);
const currentDate: Date = new Date();
expect(component.currentDate.getMinutes()).toEqual(currentDate.getMinutes());
});

it('should show the current seconds of day', () => {
const currentDate: Date = new Date();
expect(component.currentDate.getSeconds()).toEqual(currentDate.getSeconds());
});

});