Skip to content

Commit

Permalink
AG-1425 fix breaking unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sagely1 committed May 9, 2024
1 parent 45ffc4c commit 9f19393
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ describe('Component: GeneComparisonToolComponent', () => {

it('should search', () => {
component.initData([comparisonGeneMock1, comparisonGeneMock2]);
component.refresh();
fixture.detectChanges();

const input = element.querySelector(
Expand Down Expand Up @@ -180,7 +181,7 @@ describe('Component: GeneComparisonToolComponent', () => {

el = element.querySelector('#pinned-genes-header') as HTMLElement;

expect(el.textContent).toBe('Pinned Genes (1/50)');
expect(el.textContent?.trim()).toBe('Pinned Genes (1/50)');
});

it('should pin/upin gene', () => {
Expand All @@ -191,11 +192,11 @@ describe('Component: GeneComparisonToolComponent', () => {
fixture.detectChanges();
expect(component.pinnedGenes.length).toEqual(0);

component.pinGene(comparisonGeneMock1, true);
component.onPinGeneClick(comparisonGeneMock1);
fixture.detectChanges();
expect(component.pinnedGenes.length).toEqual(1);

component.unpinGene(comparisonGeneMock1, true);
component.onUnPinGeneClick(comparisonGeneMock1, true);
fixture.detectChanges();
expect(component.pinnedGenes.length).toEqual(0);
});
Expand Down Expand Up @@ -397,7 +398,7 @@ describe('Component: GeneComparisonToolComponent', () => {
expect(
element.querySelector(TOGGLE_CLASS)?.querySelector('input')?.checked
).toBeTrue();
expect(component.getUrlParam('significance')[0]).toEqual(
expect(component.getUrlParam('significance')).toEqual(
threshold
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,6 @@ export class GeneComparisonToolComponent implements OnInit, AVI, OnDestroy {
return property.split('.').reduce((o: any, i: any) => o[i], gene);
}

getPreviousPins() {
return this.pinnedGenes;
}

initData(genes: GCTGene[]) {
// hide brain region columns initially
this.brainRegionsColumns.forEach(c => c.visible = false);
Expand Down Expand Up @@ -656,21 +652,12 @@ export class GeneComparisonToolComponent implements OnInit, AVI, OnDestroy {
this.lastPinnedSubCategory = this.subCategory;
}

getPinCategories() {
const categories = this.getPinnedGenesCacheKey(this.category, this.subCategory);
return categories;
}

getPinnedGenesCacheKey(category: string, subCategory?: string) {
return (category + (subCategory ? '-' + subCategory : ''))
.replace(/[^a-z0-9]/gi, '')
.toLowerCase();
}

getPinnedGenesCache() {
return this.pinnedGenesCache;
}

setPinnedGenesCache(genes: GCTGene[]) {
this.pinnedGenesCache = genes;
}
Expand Down Expand Up @@ -966,7 +953,7 @@ export class GeneComparisonToolComponent implements OnInit, AVI, OnDestroy {
}

if (this.significanceThresholdActive) {
params['significance'] = [this.significanceThreshold];
params['significance'] = this.significanceThreshold;
}

this.urlParams = params;
Expand Down

0 comments on commit 9f19393

Please sign in to comment.