1 | import test from 'tape'
|
2 | import HelloWorld from './index.jsx'
|
3 | import React from 'react'
|
4 | import {addons} from 'react/addons'
|
5 | import testTree from 'react-test-tree'
|
6 | const {TestUtils} = addons
|
7 | const {isElement} = TestUtils
|
8 |
|
9 | test('HelloWorld: constructor', (t) => {
|
10 | const helloWorld = React.createElement(HelloWorld)
|
11 |
|
12 | t.ok(
|
13 | isElement(helloWorld)
|
14 | , 'is a valid react component'
|
15 | )
|
16 |
|
17 | t.end()
|
18 | })
|
19 |
|
20 |
|
21 | test('HelloWorld: render', (t) => {
|
22 | const name = 'john doe'
|
23 | const tree = testTree(<HelloWorld name={name} />)
|
24 |
|
25 | t.equal(
|
26 | tree.title.innerText
|
27 | , name
|
28 | , 'puts the name prop in the title'
|
29 | )
|
30 |
|
31 | t.end()
|
32 | })
|
33 |
|
34 |
|
\ | No newline at end of file |