Last active
July 7, 2022 14:10
-
-
Save crcn/649513464e1fd1cfddda813dde691770 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe(() => { | |
let ConnectedPage; | |
// Wrap the page with everything it needs to work | |
beforeEach(() => { | |
ConnectedPage = ({ state, ...rest}) => <SomeStoreContext.Provider value={state}> | |
<Page {...rest} /> | |
</SomeStoreContext.Provider> | |
}); | |
// Smoke test. useContext should throw an esception if context is not provided | |
it(`Breaks without connected context`, () => { | |
expect(() => <Page />).to.throw("Context does not exist error"); | |
}); | |
// Test page with initial state | |
it(`Connect render the page with connected state`, () => { | |
<ConnectedPage state={INITIAL_STATE} /> | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment