Created by: gaelollivier
Fix #545 (closed)
Test plan
Run npm run create-react-app my-app and in the generated App.js, add something like localStorage.getItem('test');. Run npm test, it should fail because localStorage is undefined. Add a setupTests.js in src that looks like this:
const localStorageMock = {
getItem: jest.fn(),
setItem: jest.fn(),
clear: jest.fn()
};
global.localStorage = localStorageMock
Then run npm test again (you need to re-run the command in order to have the setupTests.js added to Jest config) and it should pass.
You can also simply add a setupTests.js that does a console.log('Hello world') to check it's properly executed before the tests.