Testing my angular2 app. I try and set a spy and then check how many times it has been called. I keep getting this TS error though
Property 'calls' does not exist on type '() => any'.
How Do I resolve this error?
describe('ssh Service', () => {
let ref:SshRefService;
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
{ provide: SshRefService, useClass: refClass },
]
});
});
beforeEach(inject([SshRefService], (sshRef:SshRefService) => {
ref = sshRef
spyOn(ref, 'getClient').and.returnValue(true)
}));
it('should mock an observable', () => {
//service.list() calls ref.getClient() internally
expect(service.list('/share')).toEqual(Observable.of(mockFileList));
expect(ref.getClient.calls.count()).toBe(1);
});
});