I have this simple component:
@Component({
selector: 'messages',
styleUrls: ['messages.component.scss'],
templateUrl: 'messages.component.html',
})
export class MessagesComponent implements OnInit {
constructor(private dataService: DataService) {}
public getOne(): number{
return 1;
}
}
I'm trying to run a test for it but I can't get it to work please help:
describe('Component: MessagesComponent', () => {
let component: MessagesComponent;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [MessagesComponent],
}).compileComponents();
const fixture = TestBed.createComponent(MessagesComponent);
component = fixture.componentInstance;
});
it('should have a defined component', () => {
expect(true).toBeTruthy();
});
});
(I'm using webpack if that is relevant)
This is the error I get:
Error: This test module uses the component MessagesComponent
which is using a "templateUrl", but they were never compiled.
Please call "TestBed.compileComponents" before your test.