I am writing an Angular application. I have a test for my component (losely following this manual), where I want to check that my ngOnInit() calls the provided (mock) service, and initialises my property foos with an array of Foo objects.
it('should have foos after Angular calls ngOnInit', () => {
component.ngOnInit();
expect(component.foos).toBeInstanceOf(Foo);
});
The above works for a single object, but not for an array. If I check for Array the test passes, but isn't particularly useful.
expect(component.foos).toBeInstanceOf(Array);
I tried Foo[], but that gave me an error.
An element access expression should take an argument.
I realise this test is not useful in general because typescript will complain if it returns something that is he wrong class. But I still want to know as a matter of principle.