fix: Report media failures once per failure (#2666)
This commit is contained in:
@@ -75,6 +75,15 @@ export const createUnansweredMediaURL = (): string => createTestMediaURL([]);
|
||||
export const createStallingMediaURL = (filename?: string): string =>
|
||||
createTestMediaURL([HTTP_OK], false, filename);
|
||||
|
||||
/**
|
||||
* How many requests a media URL has been asked for, so a test can count what
|
||||
* the card actually fetched rather than only what it displayed.
|
||||
*/
|
||||
export const getTestMediaRequestCount = (url: string): number => {
|
||||
const token = new URL(url, window.location.href).searchParams.get('token');
|
||||
return (token ? requestCounts.get(token) : null) ?? 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Serves a fixture at `/test-media/<file>`, behaving as the query asks:
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user