Created
June 13, 2020 14:21
-
-
Save Dromediansk/7ed49cdf97aa45701d224f6d3182e5e3 to your computer and use it in GitHub Desktop.
falsy.reference test in useFetch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it("should not fetch data if current reference is falsy", async () => { | |
const { result } = renderHook(() => | |
useFetch(stubbedFetchUrl, { current: false }, []) | |
); | |
expect(global.fetch).not.toHaveBeenCalled(); | |
expect(result.current).toStrictEqual({ | |
loading: true, | |
data: [], | |
error: null, | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment