Skip to content

Instantly share code, notes, and snippets.


Toni Leigh Sharpe toni-sharpe

View GitHub Profile
toni-sharpe / jest-mock-eg.js
Created Jul 5, 2019
Jest Mock Module Example
View jest-mock-eg.js
// Path to the module to mock
// Then function which is called when the module is accessed
jest.mock("../mocked-module", () => ({
// Allows for multiple exports and a default to be mocked out individually
__esModule: true,
// Immediately returning the args like this is a substitute for inspecting the calledWith
// on a mock (Jest mock does not allow access to surrounding variables like a closure would)
default: jest.fn(args => args),
# curl -fsSL <url_for_raw_version_of_this_gist> | bash
# ensure you're in the root
cd ~
# Back up the notes , sublime-projects and ui-snippets folders
cp -r ~/notes /media/psf/Home/dev/parallels
cp -r ~/sublime-projects /media/psf/Home/dev/parallels
cp -r ~/ui-snippets /media/psf/Home/dev/parallels