UNPKG

677 BJavaScriptView Raw
1import test from 'tape'
2import HelloWorld from './index.jsx'
3import React from 'react'
4import {addons} from 'react/addons'
5import testTree from 'react-test-tree'
6const {TestUtils} = addons
7const {isElement} = TestUtils
8
9test('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// I'm a sample test, you probably want to delete me
21test('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