2020-10-09 16:21:21 +00:00
|
|
|
import { TestBed, waitForAsync } from '@angular/core/testing';
|
2020-10-09 13:32:53 +00:00
|
|
|
import { HttpClientModule } from '@angular/common/http';
|
2020-10-09 16:21:21 +00:00
|
|
|
import { FormsModule } from '@angular/forms';
|
|
|
|
import { MockService } from 'ng-mocks';
|
2020-10-09 13:32:53 +00:00
|
|
|
import { AppComponent } from './app.component';
|
2020-10-09 16:21:21 +00:00
|
|
|
import { MessagesService } from './messages.service';
|
|
|
|
import { of } from 'rxjs';
|
2020-10-09 13:32:53 +00:00
|
|
|
|
|
|
|
describe('AppComponent', () => {
|
2020-10-09 16:21:21 +00:00
|
|
|
beforeEach(
|
|
|
|
waitForAsync(() => {
|
|
|
|
TestBed.configureTestingModule({
|
|
|
|
declarations: [AppComponent],
|
|
|
|
imports: [HttpClientModule, FormsModule],
|
|
|
|
providers: [
|
|
|
|
{ provide: MessagesService, useValue: MockService(MessagesService) },
|
|
|
|
],
|
|
|
|
}).compileComponents();
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
const messageService = TestBed.inject(MessagesService);
|
|
|
|
jest.spyOn(messageService, 'getMessages').mockReturnValue(of([]));
|
|
|
|
});
|
2020-10-09 13:32:53 +00:00
|
|
|
|
|
|
|
it('should create the app', () => {
|
|
|
|
const fixture = TestBed.createComponent(AppComponent);
|
|
|
|
const app = fixture.debugElement.componentInstance;
|
|
|
|
expect(app).toBeTruthy();
|
|
|
|
});
|
|
|
|
});
|