diff --git a/src/ipa-bcfier-ui/src/app/app.component.spec.ts b/src/ipa-bcfier-ui/src/app/app.component.spec.ts index e375e8af..5aa8fa40 100644 --- a/src/ipa-bcfier-ui/src/app/app.component.spec.ts +++ b/src/ipa-bcfier-ui/src/app/app.component.spec.ts @@ -1,10 +1,11 @@ import { TestBed } from '@angular/core/testing'; import { AppComponent } from './app.component'; +import { AppTestingModule } from './app.testing.module'; describe('AppComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [AppComponent], + imports: [AppComponent, AppTestingModule], }).compileComponents(); }); diff --git a/src/ipa-bcfier-ui/src/app/app.testing.module.ts b/src/ipa-bcfier-ui/src/app/app.testing.module.ts new file mode 100644 index 00000000..792924f9 --- /dev/null +++ b/src/ipa-bcfier-ui/src/app/app.testing.module.ts @@ -0,0 +1,23 @@ +import { provideHttpClient } from '@angular/common/http'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; +import { NgModule } from '@angular/core'; +import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; +import { RouterModule } from '@angular/router'; +import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { ToastrModule, ToastrService } from 'ngx-toastr'; +import { provideNativeDateAdapter } from '@angular/material/core'; + +@NgModule({ + declarations: [], + imports: [RouterModule.forRoot([]), ToastrModule, NoopAnimationsModule], + exports: [ToastrModule, RouterModule], + providers: [ + { provide: MatDialogRef, useValue: { close: () => {} } }, + { provide: MAT_DIALOG_DATA, useValue: [] }, + { provide: ToastrService, useValue: {} }, + provideNativeDateAdapter(), + provideHttpClient(), + provideHttpClientTesting() + ] +}) +export class AppTestingModule {} diff --git a/src/ipa-bcfier-ui/src/app/components/add-snapshot-viewpoint/add-snapshot-viewpoint.component.spec.ts b/src/ipa-bcfier-ui/src/app/components/add-snapshot-viewpoint/add-snapshot-viewpoint.component.spec.ts index 3c6c45ff..931b7420 100644 --- a/src/ipa-bcfier-ui/src/app/components/add-snapshot-viewpoint/add-snapshot-viewpoint.component.spec.ts +++ b/src/ipa-bcfier-ui/src/app/components/add-snapshot-viewpoint/add-snapshot-viewpoint.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AddSnapshotViewpointComponent } from './add-snapshot-viewpoint.component'; +import { AppTestingModule } from '../../app.testing.module'; describe('AddSnapshotViewpointComponent', () => { let component: AddSnapshotViewpointComponent; @@ -8,10 +9,10 @@ describe('AddSnapshotViewpointComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [AddSnapshotViewpointComponent] + imports: [AddSnapshotViewpointComponent, AppTestingModule] }) .compileComponents(); - + fixture = TestBed.createComponent(AddSnapshotViewpointComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/ipa-bcfier-ui/src/app/components/add-string-value/add-string-value.component.spec.ts b/src/ipa-bcfier-ui/src/app/components/add-string-value/add-string-value.component.spec.ts index 77885b5b..b7866937 100644 --- a/src/ipa-bcfier-ui/src/app/components/add-string-value/add-string-value.component.spec.ts +++ b/src/ipa-bcfier-ui/src/app/components/add-string-value/add-string-value.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AddStringValueComponent } from './add-string-value.component'; +import { AppTestingModule } from '../../app.testing.module'; describe('AddStringValueComponent', () => { let component: AddStringValueComponent; @@ -8,10 +9,10 @@ describe('AddStringValueComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [AddStringValueComponent] + imports: [AddStringValueComponent, AppTestingModule] }) .compileComponents(); - + fixture = TestBed.createComponent(AddStringValueComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/ipa-bcfier-ui/src/app/components/add-user/add-user.component.spec.ts b/src/ipa-bcfier-ui/src/app/components/add-user/add-user.component.spec.ts index 321b846d..4a25855c 100644 --- a/src/ipa-bcfier-ui/src/app/components/add-user/add-user.component.spec.ts +++ b/src/ipa-bcfier-ui/src/app/components/add-user/add-user.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AddUserComponent } from './add-user.component'; +import { AppTestingModule } from '../../app.testing.module'; describe('AddUserComponent', () => { let component: AddUserComponent; @@ -8,10 +9,10 @@ describe('AddUserComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [AddUserComponent] + imports: [AddUserComponent, AppTestingModule] }) .compileComponents(); - + fixture = TestBed.createComponent(AddUserComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.html b/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.html index 1caa2eb7..431a9b47 100644 --- a/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.html +++ b/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.html @@ -1,4 +1,4 @@ -
+
diff --git a/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.spec.ts b/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.spec.ts index 0d7c80bb..7710fcb8 100644 --- a/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.spec.ts +++ b/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { BcfFileComponent } from './bcf-file.component'; +import { AppTestingModule } from '../../app.testing.module'; describe('BcfFileComponent', () => { let component: BcfFileComponent; @@ -8,10 +9,10 @@ describe('BcfFileComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [BcfFileComponent] + imports: [BcfFileComponent, AppTestingModule] }) .compileComponents(); - + fixture = TestBed.createComponent(BcfFileComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.ts b/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.ts index a2e5aa26..a8444df7 100644 --- a/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.ts +++ b/src/ipa-bcfier-ui/src/app/components/bcf-file/bcf-file.component.ts @@ -88,6 +88,7 @@ export class BcfFileComponent { private dialog = inject(MatDialog); ngOnInit() { + if (!this.bcfFile) return; this.selectedTopic = this.bcfFile.topics[0] || null; this.topicMessengerService.setSelectedTopic(this.selectedTopic); this.cdr.detectChanges(); diff --git a/src/ipa-bcfier-ui/src/app/components/bulk-edit-topic/bulk-edit-topic.component.spec.ts b/src/ipa-bcfier-ui/src/app/components/bulk-edit-topic/bulk-edit-topic.component.spec.ts index 7184ddd1..ca7ca984 100644 --- a/src/ipa-bcfier-ui/src/app/components/bulk-edit-topic/bulk-edit-topic.component.spec.ts +++ b/src/ipa-bcfier-ui/src/app/components/bulk-edit-topic/bulk-edit-topic.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { BulkTopicEditComponent } from './bulk-edit-topic.component'; +import { AppTestingModule } from '../../app.testing.module'; describe('BulkTopicEditComponent', () => { let component: BulkTopicEditComponent; @@ -8,7 +9,7 @@ describe('BulkTopicEditComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [BulkTopicEditComponent], + imports: [BulkTopicEditComponent, AppTestingModule], }).compileComponents(); fixture = TestBed.createComponent(BulkTopicEditComponent); diff --git a/src/ipa-bcfier-ui/src/app/components/cad-error-dialog/cad-error-dialog.component.spec.ts b/src/ipa-bcfier-ui/src/app/components/cad-error-dialog/cad-error-dialog.component.spec.ts index 46ecc16d..d8b50cd2 100644 --- a/src/ipa-bcfier-ui/src/app/components/cad-error-dialog/cad-error-dialog.component.spec.ts +++ b/src/ipa-bcfier-ui/src/app/components/cad-error-dialog/cad-error-dialog.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { CadErrorDialogComponent } from './cad-error-dialog.component'; +import { AppTestingModule } from '../../app.testing.module'; describe('CadErrorDialogComponent', () => { let component: CadErrorDialogComponent; @@ -8,10 +9,10 @@ describe('CadErrorDialogComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [CadErrorDialogComponent] + imports: [CadErrorDialogComponent, AppTestingModule] }) .compileComponents(); - + fixture = TestBed.createComponent(CadErrorDialogComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/ipa-bcfier-ui/src/app/components/comments-detail/comments-detail.component.spec.ts b/src/ipa-bcfier-ui/src/app/components/comments-detail/comments-detail.component.spec.ts index 544dc17b..294d9aef 100644 --- a/src/ipa-bcfier-ui/src/app/components/comments-detail/comments-detail.component.spec.ts +++ b/src/ipa-bcfier-ui/src/app/components/comments-detail/comments-detail.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { CommentsDetailComponent } from './comments-detail.component'; +import { AppTestingModule } from '../../app.testing.module'; describe('CommentsDetailComponent', () => { let component: CommentsDetailComponent; @@ -8,7 +9,7 @@ describe('CommentsDetailComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [CommentsDetailComponent], + imports: [CommentsDetailComponent, AppTestingModule], }).compileComponents(); fixture = TestBed.createComponent(CommentsDetailComponent); diff --git a/src/ipa-bcfier-ui/src/app/components/image-preview/image-preview.component.spec.ts b/src/ipa-bcfier-ui/src/app/components/image-preview/image-preview.component.spec.ts index b4e2a5f5..bdab836e 100644 --- a/src/ipa-bcfier-ui/src/app/components/image-preview/image-preview.component.spec.ts +++ b/src/ipa-bcfier-ui/src/app/components/image-preview/image-preview.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ImagePreviewComponent } from './image-preview.component'; +import { AppTestingModule } from '../../app.testing.module'; describe('ImagePreviewComponent', () => { let component: ImagePreviewComponent; @@ -8,10 +9,10 @@ describe('ImagePreviewComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [ImagePreviewComponent] + imports: [ImagePreviewComponent, AppTestingModule] }) .compileComponents(); - + fixture = TestBed.createComponent(ImagePreviewComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.spec.ts b/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.spec.ts index 010c5ff4..8a6e2115 100644 --- a/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.spec.ts +++ b/src/ipa-bcfier-ui/src/app/components/navisworks-clash-selection/navisworks-clash-selection.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { NavisworksClashSelectionComponent } from './navisworks-clash-selection.component'; +import { AppTestingModule } from '../../app.testing.module'; describe('NavisworksClashSelectionComponent', () => { let component: NavisworksClashSelectionComponent; @@ -8,10 +9,10 @@ describe('NavisworksClashSelectionComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [NavisworksClashSelectionComponent] + imports: [NavisworksClashSelectionComponent, AppTestingModule] }) .compileComponents(); - + fixture = TestBed.createComponent(NavisworksClashSelectionComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/ipa-bcfier-ui/src/app/components/settings/settings.component.spec.ts b/src/ipa-bcfier-ui/src/app/components/settings/settings.component.spec.ts index b0f7d8f4..e8066be0 100644 --- a/src/ipa-bcfier-ui/src/app/components/settings/settings.component.spec.ts +++ b/src/ipa-bcfier-ui/src/app/components/settings/settings.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { SettingsComponent } from './settings.component'; +import { AppTestingModule } from '../../app.testing.module'; describe('SettingsComponent', () => { let component: SettingsComponent; @@ -8,10 +9,10 @@ describe('SettingsComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [SettingsComponent] + imports: [SettingsComponent, AppTestingModule] }) .compileComponents(); - + fixture = TestBed.createComponent(SettingsComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/ipa-bcfier-ui/src/app/components/top-menu/top-menu.component.spec.ts b/src/ipa-bcfier-ui/src/app/components/top-menu/top-menu.component.spec.ts index d10414ce..b6cf48ec 100644 --- a/src/ipa-bcfier-ui/src/app/components/top-menu/top-menu.component.spec.ts +++ b/src/ipa-bcfier-ui/src/app/components/top-menu/top-menu.component.spec.ts @@ -1,6 +1,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { TopMenuComponent } from './top-menu.component'; +import { AppTestingModule } from '../../app.testing.module'; describe('TopMenuComponent', () => { let component: TopMenuComponent; @@ -8,10 +9,10 @@ describe('TopMenuComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [TopMenuComponent] + imports: [TopMenuComponent, AppTestingModule] }) .compileComponents(); - + fixture = TestBed.createComponent(TopMenuComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/ipa-bcfier-ui/src/app/components/topic-detail/topic-detail.component.html b/src/ipa-bcfier-ui/src/app/components/topic-detail/topic-detail.component.html index 4dab01ce..bc37f840 100644 --- a/src/ipa-bcfier-ui/src/app/components/topic-detail/topic-detail.component.html +++ b/src/ipa-bcfier-ui/src/app/components/topic-detail/topic-detail.component.html @@ -1,4 +1,4 @@ -
+
Title { let component: TopicDetailComponent; @@ -8,10 +9,10 @@ describe('TopicDetailComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [TopicDetailComponent] + imports: [TopicDetailComponent, AppTestingModule] }) .compileComponents(); - + fixture = TestBed.createComponent(TopicDetailComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/ipa-bcfier-ui/src/app/components/users/users.component.spec.ts b/src/ipa-bcfier-ui/src/app/components/users/users.component.spec.ts index fff471eb..790de5a3 100644 --- a/src/ipa-bcfier-ui/src/app/components/users/users.component.spec.ts +++ b/src/ipa-bcfier-ui/src/app/components/users/users.component.spec.ts @@ -1,17 +1,22 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UsersComponent } from './users.component'; +import { AppTestingModule } from '../../app.testing.module'; +import { UsersService } from '../../services/light-query/users.service'; describe('UsersComponent', () => { let component: UsersComponent; let fixture: ComponentFixture; + UsersService.prototype.disconnect = () => {}; beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [UsersComponent] + imports: [UsersComponent, AppTestingModule], + providers: [ + { provide: UsersService } + ] }) .compileComponents(); - fixture = TestBed.createComponent(UsersComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/ipa-bcfier-ui/src/app/components/users/users.component.ts b/src/ipa-bcfier-ui/src/app/components/users/users.component.ts index 75585ce7..a1608afb 100644 --- a/src/ipa-bcfier-ui/src/app/components/users/users.component.ts +++ b/src/ipa-bcfier-ui/src/app/components/users/users.component.ts @@ -43,7 +43,6 @@ import { UsersService } from '../../services/light-query/users.service'; MatTableModule, MatSortModule, MatPaginatorModule, - AsyncPipe, MatIconModule, MatButtonModule, FormsModule, diff --git a/src/ipa-bcfier-ui/src/app/services/connectors/bcfier-hub-connector.service.spec.ts b/src/ipa-bcfier-ui/src/app/services/connectors/bcfier-hub-connector.service.spec.ts index 28d91f19..d4d7ac2f 100644 --- a/src/ipa-bcfier-ui/src/app/services/connectors/bcfier-hub-connector.service.spec.ts +++ b/src/ipa-bcfier-ui/src/app/services/connectors/bcfier-hub-connector.service.spec.ts @@ -1,12 +1,15 @@ import { TestBed } from '@angular/core/testing'; import { BcfierHubConnectorService } from './bcfier-hub-connector.service'; +import { AppTestingModule } from '../../app.testing.module'; describe('BcfierHubConnectorService', () => { let service: BcfierHubConnectorService; beforeEach(() => { - TestBed.configureTestingModule({}); + TestBed.configureTestingModule({ + imports: [AppTestingModule] + }); service = TestBed.inject(BcfierHubConnectorService); }); diff --git a/src/ipa-bcfier-ui/src/app/services/notifications.service.spec.ts b/src/ipa-bcfier-ui/src/app/services/notifications.service.spec.ts index c939c4c3..bfb8bca0 100644 --- a/src/ipa-bcfier-ui/src/app/services/notifications.service.spec.ts +++ b/src/ipa-bcfier-ui/src/app/services/notifications.service.spec.ts @@ -1,12 +1,15 @@ import { TestBed } from '@angular/core/testing'; import { NotificationsService } from './notifications.service'; +import { AppTestingModule } from '../app.testing.module'; describe('NotificationsService', () => { let service: NotificationsService; beforeEach(() => { - TestBed.configureTestingModule({}); + TestBed.configureTestingModule({ + imports: [AppTestingModule] + }); service = TestBed.inject(NotificationsService); }); diff --git a/src/ipa-bcfier-ui/src/app/services/settings-messenger.service.spec.ts b/src/ipa-bcfier-ui/src/app/services/settings-messenger.service.spec.ts index 2e4db058..57337667 100644 --- a/src/ipa-bcfier-ui/src/app/services/settings-messenger.service.spec.ts +++ b/src/ipa-bcfier-ui/src/app/services/settings-messenger.service.spec.ts @@ -1,12 +1,15 @@ import { TestBed } from '@angular/core/testing'; import { SettingsMessengerService } from './settings-messenger.service'; +import { AppTestingModule } from '../app.testing.module'; describe('SettingsMessengerService', () => { let service: SettingsMessengerService; beforeEach(() => { - TestBed.configureTestingModule({}); + TestBed.configureTestingModule({ + imports: [AppTestingModule] + }); service = TestBed.inject(SettingsMessengerService); });