Skip to content

Commit

Permalink
Clarify waitError import
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Oct 8, 2024
1 parent 18dd023 commit 85aaea5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .cursorrules
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Follow these rules when you write tests:
- When you are testing for errors, use `waitError` to wait for the error to be thrown. For example:

```
import waitError from "@peated/server/lib/test/waitError";

const err = await waitError(
caller.authPasswordResetConfirm({
token,
Expand All @@ -59,7 +61,7 @@ const err = await waitError(
);
```

- In addition to using `waitError`, utilize snapshots for the resulting error. For example, ```expect(err).toMatchInlineSnapshot();``
- In addition to using `waitError`, utilize snapshots for the resulting error. For example, ``expect(err).toMatchInlineSnapshot();`
- Prefer dependency injection over mocking when the called functions make it possible.
- When calling tRPC endpoints that are not expected to error, await on the caller. Do not test the Promise directly. For example:

Expand Down

0 comments on commit 85aaea5

Please sign in to comment.