-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
31 lines (25 loc) · 684 Bytes
/
test.js
File metadata and controls
31 lines (25 loc) · 684 Bytes
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
import test from 'ava'
import React from 'react'
import ReactAutoBinder from './index'
class MyComponent extends React.Component {
constructor() {
super()
this.value = 42
}
getValue() {
return this.value
}
updateValue(newValue) {
this.value = newValue
}
}
const BoundedComponent = ReactAutoBinder(MyComponent)
test('should be able to access unbounded methods', async t => {
const component = new BoundedComponent()
t.deepEqual(component.getValue(), 42)
})
test('should be able to access multiples unbounded methods', async t => {
const component = new BoundedComponent()
component.updateValue(123)
t.deepEqual(component.getValue(), 123)
})