Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to mock prismjs in consumers #91

Open
kylesuss opened this issue Oct 8, 2019 · 0 comments
Open

Document how to mock prismjs in consumers #91

kylesuss opened this issue Oct 8, 2019 · 0 comments
Labels
documentation Changes only affect the documentation

Comments

@kylesuss
Copy link
Collaborator

kylesuss commented Oct 8, 2019

Mocking prismjs was a bit difficult in one of the consumers. I tried this in the test file:

jest.mock('prismjs/components/index');
jest.mock('prismjs', () => ({
  highlightAllUnder: jest.fn(),
}));

Sadly that did not work & I had to create mock files like this:

// __mocks__/prismjs/components/index.js
const loadLanguages = jest.fn();

export default loadLanguages;
// __mocks__/prismjs.js 
export default {
  highlightAllUnder: jest.fn(),
};

Figure out if that is the best way to do this & add something to the README about it so others don't waste time on it.

@kylesuss kylesuss added the documentation Changes only affect the documentation label Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Changes only affect the documentation
Projects
None yet
Development

No branches or pull requests

1 participant