-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Issue summary
There are a number of tests, specifically in ComboBox.test.tsx and perhaps elsewhere, that are passing because the assertions are not called.
The affected code has this pattern:
async () => {
comboBox.find(TextField).simulate('click');
listenerMap.keyup({keyCode: Key.DownArrow});
await expect(comboBox.state('selectedIndex')).toBe(0);
};
which declares a function that never gets executed.
Expected behavior
The code wrapped inside the async arrow functions should be executed.
Actual behavior
The code inside the async arrow functions is never executed because the async arrow function is declared but never called.
Steps to reproduce the problem
- Add a
throw Error()inside the async arrow function - Run the test and observe that it still passes
Possible solution
Modify tests with the following pattern:
it('test description', () => {
...
async () => {
await ...
};
});
to be
it('test description', async () => {
...
await ...
});
It is also a good idea to verify the number of assertions the test will call using expect.assertions(number).
Metadata
Metadata
Assignees
Labels
No labels