2018-01-31 07:36:20 +00:00
|
|
|
/* eslint-env jest */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Testing pages without @provide decorator as usual
|
|
|
|
*/
|
|
|
|
|
|
|
|
import { shallow } from 'enzyme'
|
|
|
|
import React from 'react'
|
|
|
|
import renderer from 'react-test-renderer'
|
|
|
|
|
|
|
|
import App from '../pages/index.js'
|
|
|
|
|
|
|
|
describe('With Enzyme', () => {
|
|
|
|
it('App shows "Menu"', () => {
|
|
|
|
const app = shallow(<App />)
|
2018-12-17 16:34:32 +00:00
|
|
|
expect(
|
|
|
|
app
|
|
|
|
.find('li a')
|
|
|
|
.first()
|
|
|
|
.text()
|
|
|
|
).toEqual('Blog: Hello world')
|
2018-01-31 07:36:20 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('With Snapshot Testing', () => {
|
|
|
|
it('App shows "Menu"', () => {
|
|
|
|
const component = renderer.create(<App />)
|
|
|
|
const tree = component.toJSON()
|
|
|
|
expect(tree).toMatchSnapshot()
|
|
|
|
})
|
|
|
|
})
|