-
Notifications
You must be signed in to change notification settings - Fork 1
#3-Time clock find project #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
22b7119
e15d20c
c501044
56247f6
f4b586c
de4fbd6
75b33b3
ae78b3d
e2ac439
01696cf
7c8ca50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,8 +99,9 @@ export class TimeClockComponent implements OnInit { | |
timer() { | ||
this.secondsCounterRealTime += 1; | ||
if ( this.secondsCounterRealTime === 59 ) { | ||
this.minuteCounterRealTime += 1; | ||
this.secondsCounterRealTime = 0; | ||
console.log('entroooo'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove console log please. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
this.minuteCounterRealTime += 1; //1 | ||
this.secondsCounterRealTime = 0; //0 | ||
if ( this.minuteCounterRealTime === 59 ) { | ||
this.hourCounterRealTime += 1; | ||
this.minuteCounterRealTime = 0; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,4 +45,18 @@ describe('ClockComponent', () => { | |
expect(component.showClock).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should be verify the init state of vars' , () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what are you testing here? |
||
expect(component.hour).toEqual(0); | ||
expect(component.minutes).toEqual(0); | ||
expect(component.seconds).toEqual(0); | ||
expect(component.displayTime).toBeFalsy(); | ||
}); | ||
|
||
it('should enter if and assign the value to vars' , () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what are you testing here? |
||
component.showClock(); | ||
expect(component.hour).toEqual(0); | ||
expect(component.minutes).toEqual(0); | ||
expect(component.seconds).toEqual(0); | ||
}); | ||
|
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
import { FilterProjectPipe } from './filter-project.pipe'; | ||
import { Project } from '../../../../interfaces/project'; | ||
|
||
describe('FilterProjectPipe', () => { | ||
it('create an instance', () => { | ||
const pipe = new FilterProjectPipe(); | ||
expect(pipe).toBeTruthy(); | ||
}); | ||
|
||
it('test method of pipe', () => { | ||
expect(new FilterProjectPipe().transform([] , '')).toEqual([]); | ||
}); | ||
|
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,18 @@ | ||
import { Pipe, PipeTransform } from '@angular/core'; | ||
import { Project } from 'src/app/interfaces'; | ||
|
||
@Pipe({ | ||
name: 'filterProject' | ||
}) | ||
export class FilterProjectPipe implements PipeTransform { | ||
|
||
transform(value: any, arg: any): any { | ||
transform(value: Project[] = [], arg: string): string[] { | ||
|
||
const restultProjects = []; | ||
for ( const projects of value ) { | ||
if ( projects.name.toLowerCase().indexOf(arg.toLowerCase()) > -1 ) { | ||
restultProjects.push(projects); | ||
// tslint:disable-next-line: prefer-for-of | ||
for ( let i = 0; i < value.length; i++ ) { | ||
if ( value[i].name.toLowerCase().indexOf(arg.toLowerCase()) > -1 ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This if statement should be tested since this is the logic we want to make sure it's working. |
||
restultProjects.push(value[i]); | ||
} | ||
} | ||
return restultProjects; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,11 @@ describe('SearchProjectComponent', () => { | |
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
|
||
it('called method' , () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what are you testing here? |
||
component.changeFilterProject.emit('angular'); | ||
component.filterProject = 'angular'; | ||
component.changeFilterValue(); | ||
expect(component.filterProject).toEqual('angular'); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what this test is doing?
Could you please explain what are you testing here?