aboutsummaryrefslogtreecommitdiffstats
path: root/spec/javascripts
diff options
context:
space:
mode:
authorThomas Haddad2016-11-29 12:06:43 +0100
committerThomas Haddad2016-11-29 12:06:43 +0100
commit5376439a212f9e4a912c0d9520c4b3c9e7ef8f88 (patch)
treeba47182304c46975489a2732343e0bbfd470109b /spec/javascripts
parent94d9e6b8ffea5958983dfc63df7e1dcc3c5feed2 (diff)
downloadchouette-core-5376439a212f9e4a912c0d9520c4b3c9e7ef8f88.tar.bz2
Fix reducers specs with local dependency
Signed-off-by: Thomas Shawarma Haddad <thomas.haddad@af83.com>
Diffstat (limited to 'spec/javascripts')
-rw-r--r--spec/javascripts/components_spec.js40
-rw-r--r--spec/javascripts/reducers_spec.js7
-rw-r--r--spec/javascripts/spec_helper.js1
3 files changed, 44 insertions, 4 deletions
diff --git a/spec/javascripts/components_spec.js b/spec/javascripts/components_spec.js
new file mode 100644
index 000000000..fc99a3335
--- /dev/null
+++ b/spec/javascripts/components_spec.js
@@ -0,0 +1,40 @@
+var React = require('react');
+var Provider = require('react-redux').Provider;
+var actions = require('es6_browserified/actions/index');
+var App = require('es6_browserified/components/TodoList');
+var ConnectedApp = require('es6_browserified/containers/VisibleTodoList');
+var TestUtils = require('react-addons-test-utils');
+
+xdescribe('ConnectedApp', function() {
+ var connectedApp, store, initialItems;
+ var state;
+ state = [
+ {
+ text: 'first',
+ index: 0,
+ for_boarding: 'normal',
+ for_alighting: 'normal'
+ },
+ {
+ text: 'second',
+ index: 1,
+ for_boarding: 'normal',
+ for_alighting: 'normal'
+ }
+ ]
+
+ beforeEach(function() {
+ store = state
+ });
+
+ describe('state provided by the store', function() {
+ beforeEach(function() {
+ connectedApp = TestUtils.renderIntoDocument(<Provider store={store}><ConnectedApp/></Provider>);
+ });
+
+ it('passes down items', function() {
+ app = TestUtils.findRenderedComponentWithType(connectedApp, App);
+ expect(app.props.items).toEqual(initialItems);
+ });
+ });
+});
diff --git a/spec/javascripts/reducers_spec.js b/spec/javascripts/reducers_spec.js
index a4880e73e..985bdc220 100644
--- a/spec/javascripts/reducers_spec.js
+++ b/spec/javascripts/reducers_spec.js
@@ -120,7 +120,7 @@ describe('stops reducer', () => {
})
//TODO unskip when es6 is properly functionnal
- xit('should handle UPDATE_INPUT_VALUE', () => {
+ it('should handle UPDATE_INPUT_VALUE', () => {
expect(
reducer(state, {
type: 'UPDATE_INPUT_VALUE',
@@ -149,7 +149,7 @@ describe('stops reducer', () => {
)
})
- xit('should handle UPDATE_SELECT_VALUE', () => {
+ it('should handle UPDATE_SELECT_VALUE', () => {
expect(
reducer(state, {
type :'UPDATE_SELECT_VALUE',
@@ -160,9 +160,8 @@ describe('stops reducer', () => {
).toEqual(
[
{
- text: 'new value',
+ text: 'first',
index: 0,
- stoparea_id: 1,
for_boarding: 'prohibited',
for_alighting: 'normal'
},
diff --git a/spec/javascripts/spec_helper.js b/spec/javascripts/spec_helper.js
index 71d30ff8d..a2fde3860 100644
--- a/spec/javascripts/spec_helper.js
+++ b/spec/javascripts/spec_helper.js
@@ -4,6 +4,7 @@
// require support/jasmine-jquery-2.1.0
// require support/sinon
// require support/your-support-file
+require('es6-object-assign').polyfill();
//
// PhantomJS (Teaspoons default driver) doesn't have support for Function.prototype.bind, which has caused confusion.
// Use this polyfill to avoid the confusion.