You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should be able to use type-powered checking to determine if an expected value is PromiseLike with enough accurate to make a rule of it.
i.e
// fine
await expect(getEventOutcome(event)).resolves.toHaveProperty(
'approves',
2
);
// not fine: unneeded `resolves`
expect(await getEventOutcome(event)).resolves.toHaveProperty(
'approves',
2
);
likewise, we should be able to tell when a PromiseLike value is being interacted to make recommendations:
// not fine: this returns a Promise, so should be either awaited or have .resolves or .rejects
expect(fs.promises.readFile(...)).toStrictEqual(...);
However I think for now we should focus on the first case as the second has more valid edge cases that would make it much easier to get false positives, i.e
// this is valid
expect(fs.promises.readFile(...)).toBeInstanceOf(Promise);
This doesn't necessarily need to be a new rule - it could make sense to have it in valid-expect 🤔
The text was updated successfully, but these errors were encountered:
We should be able to use type-powered checking to determine if an expected value is
PromiseLike
with enough accurate to make a rule of it.i.e
likewise, we should be able to tell when a
PromiseLike
value is being interacted to make recommendations:However I think for now we should focus on the first case as the second has more valid edge cases that would make it much easier to get false positives, i.e
This doesn't necessarily need to be a new rule - it could make sense to have it in
valid-expect
🤔The text was updated successfully, but these errors were encountered: