From d3102f4224b5eeea83f4b6b29c31da2ddeca8920 Mon Sep 17 00:00:00 2001 From: QuCMGisaia Date: Thu, 14 Nov 2024 12:34:51 +0100 Subject: [PATCH] ci: fix tests --- src/app/app.component.spec.ts | 8 ++++--- .../arlas-analytics.component.spec.ts | 9 +++++--- .../arlas-list/arlas-list.component.ts | 2 +- .../arlas-wui-root.component.spec.ts | 6 ++--- src/app/services/resultlist.service.spec.ts | 23 ++++++++++++------- 5 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 5bd440cb..1b6f73d5 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -26,7 +26,7 @@ import { MatTooltipModule } from '@angular/material/tooltip'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateFakeLoader, TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { ArlasColorService, ColorGeneratorLoader } from 'arlas-web-components'; -import { ArlasCollaborativesearchService, ArlasConfigService, ArlasSettingsService, ArlasStartupService } from 'arlas-wui-toolkit'; +import { ArlasCollaborativesearchService, ArlasCollectionService, ArlasConfigService, ArlasSettingsService, ArlasStartupService } from 'arlas-wui-toolkit'; import { of } from 'rxjs'; import { ArlasWuiComponent } from './app.component'; import { ContributorService } from './services/contributors.service'; @@ -42,7 +42,8 @@ describe('ArlasWuiComponent', () => { const mockArlasStartupService = jasmine.createSpyObj('ArlasStartupService', [], { shouldRunApp: true, emptyMode: false, - contributorRegistry: new Map() + contributorRegistry: new Map(), + collectionsMap: new Map() }); const mockSettingsService = jasmine.createSpyObj('ArlasSettingsService', ['getHistogramMaxBucket']); @@ -102,7 +103,8 @@ describe('ArlasWuiComponent', () => { { provide: ColorGeneratorLoader, useValue: mockColorGeneratorLoader - } + }, + ArlasCollectionService ] }).compileComponents(); }); diff --git a/src/app/components/arlas-analytics/arlas-analytics.component.spec.ts b/src/app/components/arlas-analytics/arlas-analytics.component.spec.ts index 709bf797..142c511a 100644 --- a/src/app/components/arlas-analytics/arlas-analytics.component.spec.ts +++ b/src/app/components/arlas-analytics/arlas-analytics.component.spec.ts @@ -4,11 +4,12 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MAT_DIALOG_SCROLL_STRATEGY, MatDialog } from '@angular/material/dialog'; import { MatSnackBar } from '@angular/material/snack-bar'; import { RouterTestingModule } from '@angular/router/testing'; -import { ArlasCollaborativesearchService, ArlasStartupService } from 'arlas-wui-toolkit'; +import { ArlasCollaborativesearchService, ArlasCollectionService, ArlasStartupService } from 'arlas-wui-toolkit'; import { VisualizeService } from '../../services/visualize.service'; import { ArlasAnalyticsComponent } from './arlas-analytics.component'; import { TranslateModule, TranslateLoader, TranslateFakeLoader } from '@ngx-translate/core'; import { Overlay } from '@angular/cdk/overlay'; +import { ResultlistService } from '@services/resultlist.service'; describe('ArlasAnalyticsComponent', () => { let component: ArlasAnalyticsComponent; @@ -18,7 +19,8 @@ describe('ArlasAnalyticsComponent', () => { const mockArlasStartupService = jasmine.createSpyObj('ArlasStartupService', [], { shouldRunApp: true, emptyMode: false, - contributorRegistry: new Map() + contributorRegistry: new Map(), + collectionsMap: new Map() }); await TestBed.configureTestingModule({ @@ -46,7 +48,8 @@ describe('ArlasAnalyticsComponent', () => { provide: DIALOG_SCROLL_STRATEGY, useValue: {} }, - Overlay + Overlay, + ArlasCollectionService ] }) .compileComponents(); diff --git a/src/app/components/arlas-list/arlas-list.component.ts b/src/app/components/arlas-list/arlas-list.component.ts index 946ad751..ceb98757 100644 --- a/src/app/components/arlas-list/arlas-list.component.ts +++ b/src/app/components/arlas-list/arlas-list.component.ts @@ -60,7 +60,7 @@ export class ArlasListComponent implements OnInit, OnDestroy, AfterViewInit { public ngOnInit(): void { } public ngAfterViewInit(): void { - this.tabsList.selectedIndexChange.pipe(takeUntil(this._onDestroy$)).subscribe(e => { + this.tabsList.selectedIndexChange?.pipe(takeUntil(this._onDestroy$)).subscribe(e => { this.resultlistService.selectedListTabIndex = e; }); } diff --git a/src/app/components/arlas-wui-root/arlas-wui-root.component.spec.ts b/src/app/components/arlas-wui-root/arlas-wui-root.component.spec.ts index 119f9031..e2d1d028 100644 --- a/src/app/components/arlas-wui-root/arlas-wui-root.component.spec.ts +++ b/src/app/components/arlas-wui-root/arlas-wui-root.component.spec.ts @@ -37,7 +37,7 @@ import { ResultlistService } from 'app/services/resultlist.service'; import { VisualizeService } from 'app/services/visualize.service'; import { HistogramModule } from 'arlas-web-components'; import { - ArlasCollaborativesearchService, ArlasConfigService, ArlasSettingsService, + ArlasCollaborativesearchService, ArlasCollectionService, ArlasConfigService, ArlasSettingsService, ArlasStartupService, ArlasTaggerModule, ArlasToolKitModule, ArlasToolkitSharedModule } from 'arlas-wui-toolkit'; import { ArlasWuiRootComponent } from './arlas-wui-root.component'; @@ -86,11 +86,11 @@ describe('ArlasWuiRootComponent', () => { { provide: APP_BASE_HREF, useValue: '/' }, ResultlistService, VisualizeService, - ArlasSettingsService, { provide: ArlasSettingsService, useValue: mockSettingsService - } + }, + ArlasCollectionService ], teardown: { destroyAfterEach: false } }).compileComponents(); diff --git a/src/app/services/resultlist.service.spec.ts b/src/app/services/resultlist.service.spec.ts index 67a76715..f06996b8 100644 --- a/src/app/services/resultlist.service.spec.ts +++ b/src/app/services/resultlist.service.spec.ts @@ -1,20 +1,23 @@ +import { Overlay, OverlayModule } from '@angular/cdk/overlay'; +import { HttpClientModule } from '@angular/common/http'; import { TestBed } from '@angular/core/testing'; - +import { MatDialog, MatDialogModule } from '@angular/material/dialog'; +import { MatSnackBar } from '@angular/material/snack-bar'; import { RouterTestingModule } from '@angular/router/testing'; -import { ArlasCollaborativesearchService } from 'arlas-wui-toolkit'; +import { TranslateFakeLoader, TranslateLoader, TranslateModule } from '@ngx-translate/core'; +import { ArlasCollaborativesearchService, ArlasCollectionService } from 'arlas-wui-toolkit'; import { ResultlistService } from './resultlist.service'; -import { HttpClientModule } from '@angular/common/http'; -import { TranslateModule, TranslateLoader, TranslateFakeLoader } from '@ngx-translate/core'; -import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar'; import { VisualizeService } from './visualize.service'; -import { Overlay, OverlayModule } from '@angular/cdk/overlay'; -import { MatDialog, MatDialogModule } from '@angular/material/dialog'; describe('ResultlistService', () => { let service: ResultlistService; beforeEach(() => { + const mockArlasCollectionService = jasmine.createSpyObj('ArlasCollectionService', [], { + appUnits: new Map() + }); + TestBed.configureTestingModule({ imports: [ RouterTestingModule, @@ -28,7 +31,11 @@ describe('ResultlistService', () => { MatSnackBar, VisualizeService, Overlay, - MatDialog + MatDialog, + { + provide: ArlasCollectionService, + useValue: mockArlasCollectionService + } ], teardown: { destroyAfterEach: false } });