-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Developer Tools
Use Case
As a Compass Engineer
I want the tests for necessary errors to be properly asserted
So that I have accurate coverage of expected behavior
Acceptance Criteria
Implementation Details
- Search for all instances of chai's expect().to.throw that are not invoked ex. expect(() => someFn()).to.throw and prevent them from being written going forward. (Require invocation)
- Ensure functions passed into chai's expect().to.throw assertion are not async or promise returning since this will not catch rejections
- Consider modifying the expect().to.throw() assertion to require an argument (see bson link below) to prevent an unexpected change to the error being thrown
Testing Details
- Tests should passe
- lint rule should fail on non-invoked .to.throw usage.
References
* js-bson's wrapper around the chai assertion: https://github.com/mongodb/js-bson/blob/436465625655b795645641422aa8f284dc2fa718/test/register-bson.js#L14-L40