January 2019
Intermediate to advanced
272 pages
7h 40m
English
This appendix provides the answers to the end-of-chapter exercises.
test('renders Hello, World!', () => {
const wrapper = shallowMount(TestComponent)
expect(wrapper.text()).toContain('Hello, World!')
})
shallowMount
test('renders item.author, () => {
const item = {
author: 10
}
const wrapper = shallowMount(Item, {
propsData: { item }
})
expect(wrapper.text()).toContain(item.author)
})
test('renders item.score, () => {
const item = {
score: 10
}
const wrapper = shallowMount(Item, {
propsData: { item }
})
expect(wrapper.text()).toContain(item.score)
})
import Child from 'child' test('renders Child', () => { const wrapper = shallowMount(TestComponent) expect(wrapper.find(Child).props().testProp).toBe('some-value') ...Read now
Unlock full access