Skip to content
Snippets Groups Projects
Commit 1b455824 authored by Alexandros Georgantas's avatar Alexandros Georgantas Committed by john
Browse files

Added render test for the Chapter

parent 16c5a843
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,8 @@ import { ...@@ -3,6 +3,8 @@ import {
// mount, // mount,
shallow shallow
} from 'enzyme' } from 'enzyme'
import { shallowToJson } from 'enzyme-to-json'
import sinon from 'sinon'
// import { DropdownButton } from 'react-bootstrap' // import { DropdownButton } from 'react-bootstrap'
// import { DragDropContext } from 'react-dnd' // import { DragDropContext } from 'react-dnd'
...@@ -13,39 +15,37 @@ import { ...@@ -13,39 +15,37 @@ import {
// // grab the undecorated by dnd react component // // grab the undecorated by dnd react component
import Chapter from '../Chapter' import Chapter from '../Chapter'
const OriginalChapter = Chapter.DecoratedComponent.DecoratedComponent const OriginalChapter = Chapter.DecoratedComponent
// import ProgressIndicator from '../ProgressIndicator' // import ProgressIndicator from '../ProgressIndicator'
// import TextInput from '../../../components/TextInput' // import TextInput from '../../../components/TextInput'
// const identity = function (el) { return el } // const identity = function (el) { return el }
const identity = el => el
const { data } = global.mock const { data } = global.mock
const type = 'front'
const chapters = data.chapters.filter((chapter) => {
return chapter.division === type
})
const firstChapter = chapters[0]
let props = { let props = {
book: data.book, book: data.book,
chapter: data.chapters[0] chapter: firstChapter,
// connectDragSource: identity, id: firstChapter.id,
// connectDropTarget: identity, ink: sinon.spy(),
// isDragging: false, key: firstChapter.index,
// move: sinon.spy(),
// title: 'This title', no: 0,
// type: 'chapter', outerContainer: {},
// chapter: { remove: sinon.spy(),
// id: '123', roles: [],
// alignment: {}, title: firstChapter.title,
// division: 'front', type: firstChapter.subCategory,
// progress: { update: sinon.spy(),
// style: 0, connectDragSource: identity,
// edit: 0, connectDropTarget: identity,
// review: 0, isDragging: false
// clean: 0
// }
// },
// remove: sinon.spy(),
// update: sinon.spy(),
// roles: [],
// outerContainer: {}
} }
// function wrapInTestContext (Chapter) { // function wrapInTestContext (Chapter) {
...@@ -64,7 +64,8 @@ const getWrapper = () => { ...@@ -64,7 +64,8 @@ const getWrapper = () => {
test('should render correctly', () => { test('should render correctly', () => {
const wrapper = getWrapper() const wrapper = getWrapper()
expect(wrapper).toMatchSnapshot() const tree = shallowToJson(wrapper)
expect(tree).toMatchSnapshot()
}) })
// describe('Chapter', () => { // describe('Chapter', () => {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment