-
Notifications
You must be signed in to change notification settings - Fork 1
fix: TT-125 show customer field in time entries table #629
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
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ import { TimeEntriesComponent } from './time-entries.component'; | |
import { ActionsSubject } from '@ngrx/store'; | ||
import { EntryActionTypes } from './../../time-clock/store/entry.actions'; | ||
import { NgxMaterialTimepickerModule } from 'ngx-material-timepicker'; | ||
import { DebugElement } from '@angular/core'; | ||
|
||
describe('TimeEntriesComponent', () => { | ||
type Merged = TechnologyState & ProjectState & EntryState; | ||
|
@@ -57,6 +58,7 @@ describe('TimeEntriesComponent', () => { | |
project_name: 'Time-tracker', | ||
start_date: new Date('2020-02-05T15:36:15.887Z'), | ||
end_date: new Date('2020-02-05T18:36:15.887Z'), | ||
customer_name: 'ioet Inc.', | ||
activity_id: 'development', | ||
technologies: ['Angular', 'TypeScript'], | ||
description: 'No comments', | ||
|
@@ -375,19 +377,59 @@ describe('TimeEntriesComponent', () => { | |
component.entry = null; | ||
component.entryId = null; | ||
const lastEntry = { | ||
description : 'testing is fun', | ||
technologies : [], | ||
uri : 'http://testing.is.fun', | ||
activity_id : 'sss', | ||
project_id : 'id', | ||
start_date : new Date(new Date().setHours(0, 0, 0, 0)), | ||
end_date : new Date(new Date().setHours(0, 0, 0, 0)) | ||
description: 'testing is fun', | ||
technologies: [], | ||
uri: 'http://testing.is.fun', | ||
activity_id: 'sss', | ||
project_id: 'id', | ||
start_date: new Date(new Date().setHours(0, 0, 0, 0)), | ||
end_date: new Date(new Date().setHours(0, 0, 0, 0)) | ||
}; | ||
state.timeEntriesDataSource.data = [ lastEntry ]; | ||
state.timeEntriesDataSource.data = [lastEntry]; | ||
mockEntriesSelector = store.overrideSelector(getTimeEntriesDataSource, state.timeEntriesDataSource); | ||
|
||
component.projectSelected({ projectId : 'id'}); | ||
component.projectSelected({ projectId: 'id' }); | ||
expect(component.entry).toEqual(lastEntry); | ||
})); | ||
|
||
it('when the data source is loaded, the entry should to have customer_name field', waitForAsync(() => { | ||
component.timeEntriesDataSource$.subscribe(() => { | ||
|
||
fixture.detectChanges(); | ||
|
||
const expectedColumnTitles = [ | ||
'Date', | ||
'Time in - out', | ||
'Duration', | ||
'Customer', | ||
'Project', | ||
'Activity', | ||
'', | ||
scastillo-jp marked this conversation as resolved.
Show resolved
Hide resolved
|
||
]; | ||
|
||
const columnTitles: string[] = []; | ||
|
||
const HTMLTimeEntriesDebugElement: DebugElement = fixture.debugElement; | ||
const HTMLTimeEntriesElement: HTMLElement = HTMLTimeEntriesDebugElement.nativeElement; | ||
const HTMLTimeEntriesTable = HTMLTimeEntriesElement.querySelector('.table') as HTMLTableElement; | ||
const HTMLTableHead = HTMLTimeEntriesTable.rows[0]; | ||
|
||
Array.from(HTMLTableHead.cells).forEach(columnTitle => { | ||
columnTitles.push(columnTitle.innerText); | ||
}); | ||
|
||
expect(expectedColumnTitles).toEqual(columnTitles); | ||
|
||
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. delete this line in blank |
||
}); | ||
})); | ||
|
||
it('on success times entries data source charged, the entry should to have customer_name field', waitForAsync(() => { | ||
component.timeEntriesDataSource$.subscribe(dataSource => { | ||
const entryData = dataSource.data[0]; | ||
|
||
expect(entryData.customer_name).toContain('ioet Inc.'); | ||
|
||
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. delete this line in blank |
||
}); | ||
})); | ||
|
||
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. delete this line in blank |
||
}); |
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.
Good catch