Angular 2 with jasmine: test component with injected service
I can't manage to create a simple jasmine test for my Angular 2 project. This is what I'm trying to do: Component to test (based on a service): @Component({ providers: [AccountService], selector: "account", templateUrl: "app/account/account.component.html", }) export class AccountComponent implements OnInit { public accounts: Account[]; public error: string; constructor(private accountService: AccountService) {} public ngOnInit(): any { this.getAccounts(); } public getAccounts() { this.accountService.getAccounts() .then( accounts => this.accounts = accounts, error => this.error = error ); } }