From 60746a985997693612af0c8b43aac95b2a6e56e6 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 11 May 2017 17:09:23 -0700 Subject: Use react test utils to start composing test --- test/unit/components/pending-tx-test.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'test') 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() }) }) + -- cgit v1.2.3