Skip to content

Commit

Permalink
fixes angular tests
Browse files Browse the repository at this point in the history
Signed-off-by: Maksym Trofimenko <maksym@container-registry.com>
  • Loading branch information
Maksym Trofimenko committed Jan 19, 2025
1 parent 3aef93a commit 13acb4c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/portal/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class MyMissingTranslationHandler implements MissingTranslationHandler {
HttpClientModule,
HarborRoutingModule,
CookieModule.forRoot(),
SharedModule.forRoot(),
],
providers: [
AppConfigService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ErrorHandler } from '../../../../../shared/units/error-handler';
import { InlineAlertComponent } from '../../../../../shared/components/inline-alert/inline-alert.component';
import { AddImmutableRuleComponent } from './add-immutable-rule.component';
import { SharedTestingModule } from '../../../../../shared/shared.module';
import { CallbackPipe } from '../../../../../shared/pipes/callback.pipe';

describe('AddRuleComponent', () => {
let component: AddImmutableRuleComponent;
Expand Down Expand Up @@ -40,7 +41,11 @@ describe('AddRuleComponent', () => {
};
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [AddImmutableRuleComponent, InlineAlertComponent],
declarations: [
AddImmutableRuleComponent,
InlineAlertComponent,
CallbackPipe,
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [SharedTestingModule],
providers: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { TagRetentionService } from '../tag-retention.service';
import { ErrorHandler } from '../../../../../shared/units/error-handler';
import { InlineAlertComponent } from '../../../../../shared/components/inline-alert/inline-alert.component';
import { CallbackPipe } from '../../../../../shared/pipes/callback.pipe';

describe('AddRuleComponent', () => {
let component: AddRuleComponent;
let fixture: ComponentFixture<AddRuleComponent>;
Expand All @@ -30,7 +32,11 @@ describe('AddRuleComponent', () => {
NoopAnimationsModule,
HttpClientTestingModule,
],
declarations: [AddRuleComponent, InlineAlertComponent],
declarations: [
AddRuleComponent,
CallbackPipe,
InlineAlertComponent,
],
providers: [
TranslateService,
ErrorHandler,
Expand Down
9 changes: 1 addition & 8 deletions src/portal/src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,7 @@ ClarityIcons.add({
},
],
})
export class SharedModule {
static forRoot() {
return {
ngModule: SharedModule,
providers: [],
};
}
}
export class SharedModule {}

// this module is only for testing, you should only import this module in *.spec.ts files
@NgModule({
Expand Down

0 comments on commit 13acb4c

Please sign in to comment.