Skip to content

Instantly share code, notes, and snippets.

@theskillwithin
Last active December 14, 2017 17:05
Show Gist options
  • Save theskillwithin/74f3642903f93299d4c908b00c7dfd53 to your computer and use it in GitHub Desktop.
Save theskillwithin/74f3642903f93299d4c908b00c7dfd53 to your computer and use it in GitHub Desktop.
import React from 'react'
import configureStore from 'redux-mock-store'
import { shallow } from 'enzyme'
import Page from 'components/Page'
import { Provider } from 'react-redux'
const mockStore = configureStore({
cobrand: '',
user: {},
activeInstalls: false,
activeInstall: false,
})
describe('Page', () => {
const onClick = jest.fn()
let page
beforeEach(() => {
page = shallow(<Provider store={mockStore()}><Page /></Provider>)
})
it('should match snapshot', () => {
expect(Page).toMatchSnapshot()
})
it('should have header large classname if props.header is large', () => {
page.setProps({
header: 'large',
})
expect(page.find('.mm-header-large')).toBeTruthy()
})
it('should have header classname if props.header is not large', () => {
page.setProps({
header: false,
})
expect(page.find('.mm-header-large')).toBeTruthy()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment