Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Vijeinath committed Dec 7, 2023
1 parent d15d85a commit 7d181bd
Showing 1 changed file with 34 additions and 16 deletions.
50 changes: 34 additions & 16 deletions src/app/bibliography/bibliography.component.spec.ts
@@ -1,23 +1,41 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { BibliographyComponent } from './bibliography.component';
import { RouterTestingModule } from '@angular/router/testing';
import { BeolService } from '../services/beol.service';
import { AppInitService } from '../dsp-ui-lib/core';

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

beforeEach(waitForAsync(() => {

const appInitServiceMock = {
config: {
ontologyIRI: 'http://0.0.0.0:3333'
}
};

const beolServiceSpy = jasmine.createSpyObj('BeolService', ['getEntriesForManuscript']); // see https://angular.io/guide/testing#angular-testbed

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ BibliographyComponent ]
})
.compileComponents();
TestBed.configureTestingModule({
imports: [
RouterTestingModule,
],
declarations: [BibliographyComponent],
providers: [
{ provide: BeolService, useValue: beolServiceSpy },
{ provide: AppInitService, useValue: appInitServiceMock }
]
})
.compileComponents();

fixture = TestBed.createComponent(BibliographyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
fixture = TestBed.createComponent(BibliographyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));

it('should create', () => {
expect(component).toBeTruthy();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

0 comments on commit 7d181bd

Please sign in to comment.