-
Notifications
You must be signed in to change notification settings - Fork 13
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
AG-1328: improve handling of target nominations table display strings #1302
Conversation
hallieswan
commented
Apr 25, 2024
- drop null study values from display string
- include all values from comma separated strings
…alues from comma separated strings
const setUp = (genes: Gene[]) => { | ||
const genesResponse: GenesResponse = { | ||
items: genes | ||
}; | ||
mockApiService = TestBed.inject(ApiService); | ||
spyOn(mockApiService, 'getNominatedGenes').and.returnValue( | ||
of(genesResponse) | ||
); | ||
fixture.detectChanges(); | ||
element = fixture.nativeElement; | ||
|
||
expect(mockApiService.getNominatedGenes).toHaveBeenCalled(); | ||
|
||
const table = element.querySelector('table'); | ||
expect(table).not.toBeNull(); | ||
|
||
const rows = Array.from( | ||
table?.querySelectorAll('tbody tr') || [] | ||
) as HTMLTableRowElement[]; | ||
|
||
return { rows }; | ||
}; |
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.
Create setUp
method so that each test can specify which genes should be returned by the mock API service
); | ||
studyArray = de.target_nominations | ||
.map((nt: TargetNomination) => nt.study) | ||
.filter((item) => Boolean(item)) as string[]; |
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.
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.
as a suggestion, perhaps we can create a helper method to remove null/empty values .
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.
Done in the next commit
src/app/features/genes/components/gene-nominated-targets/gene-nominated-targets.component.ts
Show resolved
Hide resolved
src/app/features/genes/components/gene-nominated-targets/gene-nominated-targets.component.ts
Show resolved
Hide resolved
src/app/features/genes/components/gene-nominated-targets/gene-nominated-targets.component.ts
Show resolved
Hide resolved
src/app/features/genes/components/gene-nominated-targets/gene-nominated-targets.component.ts
Show resolved
Hide resolved
|
||
return array; | ||
formatDisplayValue(inputArray: string[]) { |
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.
As a suggestion, perhaps we can rename this to getCommaSeparatedString() or something similar to be a bit more descriptive.
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 call, done in next commit!