I have a class defined like this:
class MyClass{
constructor(data:Array<any>){
...
}
}
And a basic test setup in Jest like this:
test('bad args', () => {
expect(new MyClass()).toThrow();
expect(new MyClass({})).toThrow();
expect(new MyClass('string')).toThrow();
});
I would expect these to error as the type hinting does not allow for empty constructor args and expects first arg to be array not an object or string.
Can anyone help explain how I persuade Jest to run the code through Flow and error where types are incorrect?
EDIT:
I also have run flow-typed install jest@23.6.0 //correct jest version