-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathframework.spec.js
45 lines (37 loc) · 1.09 KB
/
framework.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import assert from 'assert'
import React from 'react'
import {mount, render, shallow} from 'enzyme'
class Fixture extends React.Component {
render () {
return (
<div>
<input id='checked' defaultChecked />
<input id='not' defaultChecked={false} />
</div>
)
}
}
describe('(Framework) Karma Plugins', function () {
it('Should expose "expect" globally.', function () {
assert.ok(expect)
})
it('Should expose "should" globally.', function () {
assert.ok(should)
})
it('Should have chai-as-promised helpers.', function () {
const pass = new Promise(res => res('test'))
const fail = new Promise((res, rej) => rej())
return Promise.all([
expect(pass).to.be.fulfilled,
expect(fail).to.not.be.fulfilled
])
})
it('should have chai-enzyme working', function() {
let wrapper = shallow(<Fixture />)
expect(wrapper.find('#checked')).to.be.checked()
wrapper = mount(<Fixture />)
expect(wrapper.find('#checked')).to.be.checked()
wrapper = render(<Fixture />)
expect(wrapper.find('#checked')).to.be.checked()
})
})