Comments (2)
I was able to get a store working by using my real store with https://www.npmjs.com/package/fluxxor-test-utils. Here's an example spec.
/** @jsx React.DOM */
//tests/app/modules/autocompletemaxprice-test.js
jest.dontMock('../../../app/modules/AutocompleteMaxPrice.jsx');
var React, TestUtils, FluxxorTestUtils, FluxConstructor, realFlux, fakeFlux, MyComponent, Component;
describe('Testing Autocomplete Max Price', function() {
beforeEach(function() {
React = require('react/addons');
TestUtils = React.addons.TestUtils;
FluxxorTestUtils = require('fluxxor-test-utils');
FluxConstructor = require('../../../app/FluxConstructor.js');
realFlux = FluxConstructor();
fakeFlux = FluxxorTestUtils.fakeFlux(realFlux);
fakeFlux.genMocksForStoresAndActions();
// now all store and action methods are mocked for testing
MyComponent = require('../../../app/modules/AutocompleteMaxPrice.jsx');
Component = TestUtils.renderIntoDocument(<MyComponent flux={fakeFlux} />);
});
it('when created, component should have AutocompleteMaxPrice class', function() {
var div = TestUtils.findRenderedDOMComponentWithClass(
Component, 'AutocompleteMaxPrice');
});
it('when mounted and focused, should call onTargetFocus', function() {
Component.onTargetFocus = jest.genMockFunction();
TestUtils.Simulate.focus(Component.refs.inputField.getDOMNode());
expect(Component.onTargetFocus).toBeCalled();
});
});
In our case, our stores are in the FluxConstructor. Unfortunately, there is a bug in the Simulate class which doesn't call the mocked version of Component.onTargetFocus. See Also, jestjs/jest#207
from react-starter-kit.
I'm going to close this issue for now. Feel free to reopen if needed.
from react-starter-kit.
Related Issues (20)
- Need help building an old website from 2016 HOT 5
- Error 500: Unexpected token < in JSON at position 0 HOT 3
- SPAM
- 'Cannot find module' Error for cached modules in VSCode HOT 1
- Minor issue running 'Relay' with Yarn HOT 1
- Cannot find module ... TypeScript error in VSCode HOT 1
- Hot Reload not working properly HOT 1
- Hot Reload CSS and JS files changes HOT 1
- Cannot open started application due to Firebase error HOT 2
- site.manifest error - comma missing
- What kind of API token templates should I use? HOT 1
- Where's node_modules?
- Where's node_modules? HOT 1
- Error on first start. TT HOT 2
- Network: use --host to expose HOT 1
- Codespaces not working with "Use Template" (workaround: clone/fork/duplicate repo) HOT 5
- The engine "node" is incompatible with this module. Expected version "10". Got "18.14.0" HOT 5
- Shipping with Google_Cloud_Credentials Issue HOT 2
- Login Dialog is not showing up
- Unable to add packages using Yarn HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-starter-kit.