1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00

Use react test utils to start composing test

This commit is contained in:
Dan Finlay 2017-05-11 17:09:23 -07:00
parent 16005ebd3a
commit 60746a9859
2 changed files with 23 additions and 6 deletions

View File

@ -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",

View File

@ -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()
})
})