Skip to content

Commit

Permalink
fix: fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslan-minukov committed Nov 21, 2024
1 parent 86f00e8 commit 80e4792
Show file tree
Hide file tree
Showing 22 changed files with 81 additions and 31 deletions.
3 changes: 2 additions & 1 deletion src/ipa-bcfier-ui/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -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();
});

Expand Down
23 changes: 23 additions & 0 deletions src/ipa-bcfier-ui/src/app/app.testing.module.ts
Original file line number Diff line number Diff line change
@@ -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 {}
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
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;
let fixture: ComponentFixture<AddSnapshotViewpointComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AddSnapshotViewpointComponent]
imports: [AddSnapshotViewpointComponent, AppTestingModule]
})
.compileComponents();

fixture = TestBed.createComponent(AddSnapshotViewpointComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
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;
let fixture: ComponentFixture<AddStringValueComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AddStringValueComponent]
imports: [AddStringValueComponent, AppTestingModule]
})
.compileComponents();

fixture = TestBed.createComponent(AddStringValueComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { AddUserComponent } from './add-user.component';
import { AppTestingModule } from '../../app.testing.module';

describe('AddUserComponent', () => {
let component: AddUserComponent;
let fixture: ComponentFixture<AddUserComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AddUserComponent]
imports: [AddUserComponent, AppTestingModule]
})
.compileComponents();

fixture = TestBed.createComponent(AddUserComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="wrapper">
<div class="wrapper" *ngIf="bcfFile">
<div class="issue-list">
<mat-drawer-container [hasBackdrop]="true">
<mat-drawer #drawer mode="over">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { BcfFileComponent } from './bcf-file.component';
import { AppTestingModule } from '../../app.testing.module';

describe('BcfFileComponent', () => {
let component: BcfFileComponent;
let fixture: ComponentFixture<BcfFileComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [BcfFileComponent]
imports: [BcfFileComponent, AppTestingModule]
})
.compileComponents();

fixture = TestBed.createComponent(BcfFileComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
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;
let fixture: ComponentFixture<BulkTopicEditComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [BulkTopicEditComponent],
imports: [BulkTopicEditComponent, AppTestingModule],
}).compileComponents();

fixture = TestBed.createComponent(BulkTopicEditComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
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;
let fixture: ComponentFixture<CadErrorDialogComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [CadErrorDialogComponent]
imports: [CadErrorDialogComponent, AppTestingModule]
})
.compileComponents();

fixture = TestBed.createComponent(CadErrorDialogComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { CommentsDetailComponent } from './comments-detail.component';
import { AppTestingModule } from '../../app.testing.module';

describe('CommentsDetailComponent', () => {
let component: CommentsDetailComponent;
let fixture: ComponentFixture<CommentsDetailComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [CommentsDetailComponent],
imports: [CommentsDetailComponent, AppTestingModule],
}).compileComponents();

fixture = TestBed.createComponent(CommentsDetailComponent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ImagePreviewComponent } from './image-preview.component';
import { AppTestingModule } from '../../app.testing.module';

describe('ImagePreviewComponent', () => {
let component: ImagePreviewComponent;
let fixture: ComponentFixture<ImagePreviewComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ImagePreviewComponent]
imports: [ImagePreviewComponent, AppTestingModule]
})
.compileComponents();

fixture = TestBed.createComponent(ImagePreviewComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
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;
let fixture: ComponentFixture<NavisworksClashSelectionComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [NavisworksClashSelectionComponent]
imports: [NavisworksClashSelectionComponent, AppTestingModule]
})
.compileComponents();

fixture = TestBed.createComponent(NavisworksClashSelectionComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { SettingsComponent } from './settings.component';
import { AppTestingModule } from '../../app.testing.module';

describe('SettingsComponent', () => {
let component: SettingsComponent;
let fixture: ComponentFixture<SettingsComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SettingsComponent]
imports: [SettingsComponent, AppTestingModule]
})
.compileComponents();

fixture = TestBed.createComponent(SettingsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { TopMenuComponent } from './top-menu.component';
import { AppTestingModule } from '../../app.testing.module';

describe('TopMenuComponent', () => {
let component: TopMenuComponent;
let fixture: ComponentFixture<TopMenuComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [TopMenuComponent]
imports: [TopMenuComponent, AppTestingModule]
})
.compileComponents();

fixture = TestBed.createComponent(TopMenuComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="wrapper">
<div class="wrapper" *ngIf="topic">
<mat-form-field class="top-field dark-theme">
<mat-label>Title</mat-label>
<input
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { TopicDetailComponent } from './topic-detail.component';
import { AppTestingModule } from '../../app.testing.module';

describe('TopicDetailComponent', () => {
let component: TopicDetailComponent;
let fixture: ComponentFixture<TopicDetailComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [TopicDetailComponent]
imports: [TopicDetailComponent, AppTestingModule]
})
.compileComponents();

fixture = TestBed.createComponent(TopicDetailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
Expand Down
Original file line number Diff line number Diff line change
@@ -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<UsersComponent>;
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import { UsersService } from '../../services/light-query/users.service';
MatTableModule,
MatSortModule,
MatPaginatorModule,
AsyncPipe,
MatIconModule,
MatButtonModule,
FormsModule,
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -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);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -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);
});

Expand Down

0 comments on commit 80e4792

Please sign in to comment.