Spies (mocks)

๐Ÿ‘จโ€๐Ÿ’ผ Great! Now our test output is cleaner! But do you remember our user search E2E test where we were doing the cleanup at the end of the test? The bit where we called await prisma.user.delete({ where: { id: newUser.id } }) at the end? Remember the problem that caused?
The problem it caused was if the test failed, the cleanup never ran. We solved this by using a playwright fixture and calling that after the use function call.
We've got a similar problem here with our cleanup and we can solve it in a bit of a different way with vitest. We'll do that next.

Access Denied

You must login or register for the workshop to view and run the tests.

Check out this video to see how the test tab works.