-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
197 additions
and
1 deletion.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
toc: | ||
- setupAndTeardownApp | ||
- scaleWindowWidth |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
import { setupAsync, waitUntil } from './async'; | ||
import { setupFakeFetch, teardownFakeFetch, fetchRespond } from './fetch'; | ||
|
||
/** | ||
* Convenience method to set up everything needed to use fake fetch in an async environment. | ||
* Calls {@link setupAsync}, {@link setupFakeFetch} and {@link teardownFakeFetch}. | ||
* | ||
* Use this by calling it once on top of the appropriate `describe`. | ||
*/ | ||
export function setupFakeFetchAsync() { | ||
setupAsync(); | ||
|
||
beforeEach(setupFakeFetch); | ||
afterEach(teardownFakeFetch); | ||
} | ||
|
||
|
||
/** | ||
* Waits until a fetch call has been made, and resolves with the same return value as in {@link fetchRespond}. | ||
* @param {string} path The fetched path to wait for. Same as in {@link fetchRespond}. | ||
*/ | ||
export function waitUntilFetchExists(path) { | ||
waitUntil(() => fetchRespond(path)); | ||
} |
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