aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-05-12 08:09:23 +0800
committerDan Finlay <dan@danfinlay.com>2017-05-12 08:09:23 +0800
commit60746a985997693612af0c8b43aac95b2a6e56e6 (patch)
treeeeca43dcd621f5cd7ca1009b6aa0d848231e9094
parent16005ebd3a7db5c48f9d81d5a1c77ace7ff92958 (diff)
downloadtangerine-wallet-browser-60746a985997693612af0c8b43aac95b2a6e56e6.tar
tangerine-wallet-browser-60746a985997693612af0c8b43aac95b2a6e56e6.tar.gz
tangerine-wallet-browser-60746a985997693612af0c8b43aac95b2a6e56e6.tar.bz2
tangerine-wallet-browser-60746a985997693612af0c8b43aac95b2a6e56e6.tar.lz
tangerine-wallet-browser-60746a985997693612af0c8b43aac95b2a6e56e6.tar.xz
tangerine-wallet-browser-60746a985997693612af0c8b43aac95b2a6e56e6.tar.zst
tangerine-wallet-browser-60746a985997693612af0c8b43aac95b2a6e56e6.zip
Use react test utils to start composing test
-rw-r--r--package.json4
-rw-r--r--test/unit/components/pending-tx-test.js25
2 files changed, 23 insertions, 6 deletions
diff --git a/package.json b/package.json
index e2268d20a..5f2436112 100644
--- a/package.json
+++ b/package.json
@@ -132,9 +132,11 @@
"browserify": "^13.0.0",
"chai": "^3.5.0",
"clone": "^1.0.2",
+ "create-react-factory": "^0.2.1",
"deep-freeze-strict": "^1.1.1",
"del": "^2.2.0",
"envify": "^4.0.0",
+ "enzyme": "^2.8.2",
"eslint-plugin-chai": "0.0.1",
"eslint-plugin-mocha": "^4.9.0",
"fs-promise": "^1.0.0",
@@ -161,6 +163,8 @@
"prompt": "^1.0.0",
"qs": "^6.2.0",
"qunit": "^0.9.1",
+ "react-addons-test-utils": "^15.5.1",
+ "react-dom": "^15.5.4",
"sinon": "^1.17.3",
"tape": "^4.5.1",
"testem": "^1.10.3",
diff --git a/test/unit/components/pending-tx-test.js b/test/unit/components/pending-tx-test.js
index b798865cc..caaf66b49 100644
--- a/test/unit/components/pending-tx-test.js
+++ b/test/unit/components/pending-tx-test.js
@@ -1,5 +1,13 @@
var assert = require('assert')
+const h = require('react-hyperscript')
var PendingTx = require('../../../ui/app/components/pending-tx')
+const createReactFactory = require('create-react-factory').createReactFactory
+const React = require('react')
+console.dir(createReactFactory)
+const shallow = require('enzyme').shallow
+const Factory = createReactFactory(PendingTx)
+const ReactTestUtils = require('react-addons-test-utils')
+const renderer = ReactTestUtils.createRenderer();
describe.only('PendingTx', function () {
let pendingTxComponent
@@ -43,14 +51,21 @@ describe.only('PendingTx', function () {
},
}
- pendingTxComponent = new PendingTx(props)
+ const pendingTxComponent = h(PendingTx, props)
+ renderer.render(pendingTxComponent)
+ console.dir(pendingTxComponent)
const noop = () => {}
setTimeout(() => {
- console.log('component mounted')
+ console.log('timeout finished')
- pendingTxComponent.gasPriceChanged(newGasPrice)
+ // Get the gas price input
+ // Set it to the newGasPrice value
+ // Wait for the value to change
+ // Get the submit button
+ // Click the submit button
+ // Get the output of the submit event.
setTimeout(() => {
console.log('hitting submit')
@@ -59,9 +74,7 @@ describe.only('PendingTx', function () {
}, 200)
console.log('calling render')
- pendingTxComponent.props = props
- pendingTxComponent.checkValidity = () => { return true }
- pendingTxComponent.render()
})
})
+