react-img-fallbacks
Version:
React image fallback component
19 lines (13 loc) • 458 B
JavaScript
import path from "path";
export function spyConsole() {
let spy = {};
beforeAll(() => {
spy.console = jest.spyOn(console, 'error').mockImplementation(() => {});
});
afterAll(() => {
spy.console.mockRestore();
});
return spy;
}
export const delay = (time) => new Promise((res, rej) => setTimeout(() => res(), time))
export const getLocalFileUrl = url => "file:///" + path.resolve(__dirname, url)