Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/uriklar/react-testing-library-with-use-context


https://github.com/uriklar/react-testing-library-with-use-context

Last synced: 21 days ago
JSON representation

Awesome Lists containing this project

README

        

## The goal

I want to test a component the uses a custom hook, that uses the useContext hook.

## The problem

When running two consecutive tests with a cleanup between them , my context is persisted from the previous test.

I also tried mocking the context provider between every test run.

How can I achieve a fresh context on every run?

Thanks!!!