I have the following component which retrieves data from an Angular service:
export class MyComponent {
constructor() {
myService.get().then(() => {
console.log('hello from constructor');
});
}
}
And then my unit test:
///////////
it('does something', () => {
console.log('hello from unit test');
});
///////////
Unfortunately this results in the following log:
> hello from unit test
> hello from constructor
How can I make sure that the constructor finishes before running the unit test?