-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclock.component.spec.ts
More file actions
46 lines (37 loc) · 1.34 KB
/
clock.component.spec.ts
File metadata and controls
46 lines (37 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ClockComponent } from './clock.component';
describe('ClockComponent', () => {
let component: ClockComponent;
let fixture: ComponentFixture<ClockComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ClockComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ClockComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should show the current hour of day', () => {
const currentHour = component.currentDate.getHours();
expect(component.currentDate.getHours()).toEqual(currentHour);
});
it('should show the current minutes of day', () => {
const currentMinutes = component.currentDate.getMinutes();
expect(component.currentDate.getMinutes()).toEqual(currentMinutes);
});
it('should show the current seconds of day', () => {
const currentSeconds = component.currentDate.getSeconds();
expect(component.currentDate.getSeconds()).toEqual(currentSeconds);
});
it('should startTimer called', () => {
spyOn(component, 'showClock');
component.showClock();
expect(component.showClock).toHaveBeenCalled();
});
});