Skip to content

Commit

Permalink
feat: fix ItemVersionHistoryComponent test
Browse files Browse the repository at this point in the history
  • Loading branch information
enea4science committed Sep 26, 2023
1 parent 815c09b commit 9f5dbef
Showing 1 changed file with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { VarDirective } from '../../../shared/utils/var.directive';
import { RouterTestingModule } from '@angular/router/testing';
import { TranslateModule } from '@ngx-translate/core';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { Component, NO_ERRORS_SCHEMA } from '@angular/core';
import { Item } from '../../../core/shared/item.model';
import { ActivatedRoute } from '@angular/router';
import { of as observableOf } from 'rxjs';
import { createSuccessfulRemoteDataObject } from '../../../shared/remote-data.utils';
import { ItemVersionsComponent } from '../../versions/item-versions.component';

describe('ItemVersionHistoryComponent', () => {
let component: ItemVersionHistoryComponent;
Expand All @@ -28,12 +29,22 @@ describe('ItemVersionHistoryComponent', () => {

beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), ItemVersionHistoryComponent, VarDirective],
imports: [
TranslateModule.forRoot(),
RouterTestingModule.withRoutes([]),
ItemVersionHistoryComponent,
VarDirective
],
providers: [
{ provide: ActivatedRoute, useValue: activatedRoute }
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
})
.overrideComponent(ItemVersionHistoryComponent, {
remove: {imports: [ItemVersionsComponent]},
add: { imports: [MockItemVersionsComponent]}
})
.compileComponents();
}));

beforeEach(() => {
Expand All @@ -49,3 +60,10 @@ describe('ItemVersionHistoryComponent', () => {
});
});
});

@Component({
selector: 'ds-item-versions',
template: '',
standalone: true
})
class MockItemVersionsComponent {}

0 comments on commit 9f5dbef

Please sign in to comment.