FAIL src/components/molecules/SideBar/index.test.js
● SideBar molecule test › clear localStorage on logout
TypeError: Could not parse "/" as a URL
at LocationImpl.set href [as href] (node_modules/jsdom/lib/jsdom/living/window/Location-impl.js:46:13)
at Location.set [as href] (node_modules/jsdom/lib/jsdom/living/generated/Location.js:58:21)
at onClickLogout (src/components/molecules/SideBar/index.js:8:26)
at node_modules/enzyme-adapter-react-15/build/ReactFifteenAdapter.js:329:29
at ReactDefaultBatchingStrategyTransaction.perform (node_modules/react-test-renderer/lib/shallow/Transaction.js:140:20)
at Object.batchedUpdates (node_modules/react-test-renderer/lib/shallow/ReactDefaultBatchingStrategy.js:62:26)
at Object.batchedUpdates (node_modules/react-test-renderer/lib/shallow/ReactUpdates.js:97:27)
at ReactShallowRenderer.unstable_batchedUpdates (node_modules/react-test-renderer/lib/shallow/ReactShallowRenderer.js:130:25)
at node_modules/enzyme-adapter-react-15/build/ReactFifteenAdapter.js:328:28
at withSetStateAllowed (node_modules/enzyme-adapter-utils/build/Utils.js:153:16)
@theNocturni Could you check the implementation here? Or rather, were you planning to use the onLogout, which was provided in the props for SideBar?
To test this portion of the
SideBar
molecule: https://github.com/swpp201901-team06/swpp-project/blob/0f97e090c015914bb6e853ed80b10fdc39673cfd/FD_frontend/src/components/molecules/SideBar/index.js#L6-L9I've created a test as the following:
The following error message shows up on
npm test
:@theNocturni Could you check the implementation here? Or rather, were you planning to use the
onLogout
, which was provided in the props forSideBar
?