malgo-brat-frontend-editor
Version:
"BRAT Editor standalone frontend library"
36 lines (30 loc) • 905 B
text/typescript
import { ActivatedRoute, Data } from '@angular/router';
import { Component } from '@angular/core';
import { inject, TestBed } from '@angular/core/testing';
// Load the implementations that should be tested
import { About } from './about.component';
describe('About', () => {
// provide our implementations or mocks to the dependency injector
beforeEach(() => TestBed.configureTestingModule({
providers: [
// provide a better mock
{
provide: ActivatedRoute,
useValue: {
data: {
subscribe: (fn: (value: Data) => void) => fn({
yourData: 'yolo'
})
}
}
},
About
]
}));
it('should log ngOnInit', inject([About], (about: About) => {
spyOn(console, 'log');
expect(console.log).not.toHaveBeenCalled();
about.ngOnInit();
expect(console.log).toHaveBeenCalled();
}));
});