From 3a64c78b78b9852ee8464b8292eadc45b0a5c96c Mon Sep 17 00:00:00 2001 From: Stoeffel Date: Sun, 8 Nov 2015 16:58:29 +0100 Subject: [PATCH] updates devDep - removes all warnings from the tests closes #21 --- __tests__/component-test.js | 32 +++---- __tests__/cond-test.js | 186 ++++++++++++++++++------------------ __tests__/ramda-test.js | 92 +++++++++--------- package.json | 4 +- 4 files changed, 158 insertions(+), 156 deletions(-) diff --git a/__tests__/component-test.js b/__tests__/component-test.js index 85e989e..7aadd90 100644 --- a/__tests__/component-test.js +++ b/__tests__/component-test.js @@ -1,9 +1,9 @@ jest.dontMock('../module/'); -import React from 'react/addons'; +import React from 'react'; import { equal } from 'assert'; +import TestUtils from 'react-addons-test-utils'; -const { TestUtils } = React.addons; const { Cond, Clause, @@ -16,23 +16,23 @@ describe('React-Cond components', () => { let component = TestUtils.renderIntoDocument( -

Works!

+

Works!

); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'Works!'); + equal(val.textContent, 'Works!'); }); it('should render the child component if the condition value is equal to `props.value`', () => { let component = TestUtils.renderIntoDocument( -

unexpected

-

expected

-

default

+

unexpected

+

expected

+

default

); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); it('should render the child component if the condition matches', () => { @@ -41,25 +41,25 @@ describe('React-Cond components', () => { let component = TestUtils.renderIntoDocument( -

even

-

odd

-

wut?

+

even

+

odd

+

wut?

); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'odd'); + equal(val.textContent, 'odd'); }); it('should render the default value if no cases match', () => { let component = TestUtils.renderIntoDocument( -

unexpected

-

expected

-

default

+

unexpected

+

expected

+

default

); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'default'); + equal(val.textContent, 'default'); }); }); diff --git a/__tests__/cond-test.js b/__tests__/cond-test.js index 8d5f4a6..2c2e6f4 100644 --- a/__tests__/cond-test.js +++ b/__tests__/cond-test.js @@ -1,9 +1,9 @@ jest.dontMock('../module/'); -import React from 'react/addons'; +import React from 'react'; import { equal } from 'assert'; +import TestUtils from 'react-addons-test-utils'; -const { TestUtils } = React.addons; const { Cond, T, @@ -28,73 +28,73 @@ describe('React-Cond', () => { it('should render the child component if the condition is true', () => { let component = TestUtils.renderIntoDocument( - {[ T,

expected

]} + {[ T,

expected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); it('should render the child component if the condition value is equal to `props.value`', () => { let component = TestUtils.renderIntoDocument( - {[ 2,

unexpected

]} - {[ 1,

expected

]} - {[ T,

unexpected

]} + {[ 2,

unexpected

]} + {[ 1,

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); it('should render the result of `T` if no other is true', () => { let component = TestUtils.renderIntoDocument( - {[ 2,

unexpected

]} - {[ 3,

unexpected

]} - {[ T,

expected

]} + {[ 2,

unexpected

]} + {[ 3,

unexpected

]} + {[ T,

expected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); it('should allow custom compare functions', () => { let component = TestUtils.renderIntoDocument( - {[ age => age < 10,

nope

]} - {[ age => age > 10,

expected

]} - {[ T,

unexpected

]} + {[ age => age < 10,

nope

]} + {[ age => age > 10,

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); it('should allow custom default compare functions', () => { let component = TestUtils.renderIntoDocument( a.indexOf(b) >= 0}> - {[ 0,

nope

]} - {[ 1,

unexpected

]} - {[ 2,

expected

]} - {[ T,

otherwise

]} + {[ 0,

nope

]} + {[ 1,

unexpected

]} + {[ 2,

expected

]} + {[ T,

otherwise

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); it('should only render the first truthy clause', () => { let component = TestUtils.renderIntoDocument( - {[ age => age < 10,

nope

]} - {[ age => age > 9,

expected

]} - {[ age => age > 10,

unexpected

]} - {[ T,

unexpected

]} + {[ age => age < 10,

nope

]} + {[ age => age > 9,

expected

]} + {[ age => age > 10,

unexpected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); describe('#gt', () => { @@ -102,13 +102,13 @@ describe('React-Cond', () => { it('should render the child component the value is gt the nr', () => { let component = TestUtils.renderIntoDocument( - {[ gt(11),

unexpected

]} - {[ gt(9),

expected

]} - {[ T,

unexpected

]} + {[ gt(11),

unexpected

]} + {[ gt(9),

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -117,13 +117,13 @@ describe('React-Cond', () => { it('should render the child component the value is lt the nr', () => { let component = TestUtils.renderIntoDocument( - {[ lt(10),

unexpected

]} - {[ lt(11),

expected

]} - {[ T,

unexpected

]} + {[ lt(10),

unexpected

]} + {[ lt(11),

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -132,13 +132,13 @@ describe('React-Cond', () => { it('should render the child component the value is lte the nr', () => { let component = TestUtils.renderIntoDocument( - {[ lte(9),

unexpected

]} - {[ lte(10),

expected

]} - {[ T,

unexpected

]} + {[ lte(9),

unexpected

]} + {[ lte(10),

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -147,13 +147,13 @@ describe('React-Cond', () => { it('should render the child component the value is gte the nr', () => { let component = TestUtils.renderIntoDocument( - {[ gte(11),

unexpected

]} - {[ gte(10),

expected

]} - {[ T,

unexpected

]} + {[ gte(11),

unexpected

]} + {[ gte(10),

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -162,13 +162,13 @@ describe('React-Cond', () => { it('should render the child component the value is not eq the nr', () => { let component = TestUtils.renderIntoDocument( - {[ not(eq(10)),

unexpected

]} - {[ not(eq(11)),

expected

]} - {[ T,

unexpected

]} + {[ not(eq(10)),

unexpected

]} + {[ not(eq(11)),

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -177,13 +177,13 @@ describe('React-Cond', () => { it('should render the child component the value is eq the nr', () => { let component = TestUtils.renderIntoDocument( - {[ eq(11),

unexpected

]} - {[ eq(10),

expected

]} - {[ T,

unexpected

]} + {[ eq(11),

unexpected

]} + {[ eq(10),

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -192,13 +192,13 @@ describe('React-Cond', () => { it('should render the child component the value is true', () => { let component = TestUtils.renderIntoDocument( - {[ isFalse,

unexpected

]} - {[ isTrue,

expected

]} - {[ T,

unexpected

]} + {[ isFalse,

unexpected

]} + {[ isTrue,

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -207,13 +207,13 @@ describe('React-Cond', () => { it('should render the child component the value is false', () => { let component = TestUtils.renderIntoDocument( - {[ isTrue,

unexpected

]} - {[ isFalse,

expected

]} - {[ T,

unexpected

]} + {[ isTrue,

unexpected

]} + {[ isFalse,

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -222,13 +222,13 @@ describe('React-Cond', () => { it('should render the child component the value is undefined', () => { let component = TestUtils.renderIntoDocument( - {[ isNull,

unexpected

]} - {[ isUndefined,

expected

]} - {[ T,

unexpected

]} + {[ isNull,

unexpected

]} + {[ isUndefined,

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -237,13 +237,13 @@ describe('React-Cond', () => { it('should render the child component the value is null', () => { let component = TestUtils.renderIntoDocument( - {[ isUndefined,

unexpected

]} - {[ isNull,

expected

]} - {[ T,

unexpected

]} + {[ isUndefined,

unexpected

]} + {[ isNull,

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -252,13 +252,13 @@ describe('React-Cond', () => { it('should render the child component the value is between the nr', () => { let component = TestUtils.renderIntoDocument( - {[ between(10, 12),

unexpected

]} - {[ between(9, 11),

expected

]} - {[ T,

unexpected

]} + {[ between(10, 12),

unexpected

]} + {[ between(9, 11),

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -271,15 +271,15 @@ describe('React-Cond', () => { let component = TestUtils.renderIntoDocument( - {[ and(startsWith('-'), endsWith('-')),

unexpected

]} - {[ and(startsWith('-'), endsWith('_')),

unexpected

]} - {[ and(startsWith('_'), endsWith('-')),

unexpected

]} - {[ and(startsWith('_'), endsWith('_')),

expected

]} - {[ T,

unexpected

]} + {[ and(startsWith('-'), endsWith('-')),

unexpected

]} + {[ and(startsWith('-'), endsWith('_')),

unexpected

]} + {[ and(startsWith('_'), endsWith('-')),

unexpected

]} + {[ and(startsWith('_'), endsWith('_')),

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -291,15 +291,15 @@ describe('React-Cond', () => { let component = TestUtils.renderIntoDocument( - {[ or(startsWith('-'), endsWith('-')),

unexpected

]} - {[ or(startsWith('-'), endsWith('_')),

expected

]} - {[ or(startsWith('_'), endsWith('-')),

unexpected

]} - {[ or(startsWith('_'), endsWith('_')),

unexpected

]} - {[ T,

unexpected

]} + {[ or(startsWith('-'), endsWith('-')),

unexpected

]} + {[ or(startsWith('-'), endsWith('_')),

expected

]} + {[ or(startsWith('_'), endsWith('-')),

unexpected

]} + {[ or(startsWith('_'), endsWith('_')),

unexpected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -311,12 +311,12 @@ describe('React-Cond', () => { let component = TestUtils.renderIntoDocument( - {[ not(x => x < 30),

unexpected

]} - {[ not(x => x > 30),

expected

]} + {[ not(x => x < 30),

unexpected

]} + {[ not(x => x > 30),

expected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -327,13 +327,13 @@ describe('React-Cond', () => { let component = TestUtils.renderIntoDocument( - {[ and(value('val1', eq(11)), value('val2', eq(12))),

unexpected

]} - {[ and(value('val1', eq(12)), value('val2', eq(13))),

expected

]} - {[ T,

unexpected

]} + {[ and(value('val1', eq(11)), value('val2', eq(12))),

unexpected

]} + {[ and(value('val1', eq(12)), value('val2', eq(13))),

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); it('should render the component if the value is eq to a value, with a named value', () => { @@ -341,13 +341,13 @@ describe('React-Cond', () => { let component = TestUtils.renderIntoDocument( - {[ and(eq('val1', 11), gte('val2', 12)),

unexpected

]} - {[ and(eq('val1', 12), gte('val2', 13)),

expected

]} - {[ T,

unexpected

]} + {[ and(eq('val1', 11), gte('val2', 12)),

unexpected

]} + {[ and(eq('val1', 12), gte('val2', 13)),

expected

]} + {[ T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); diff --git a/__tests__/ramda-test.js b/__tests__/ramda-test.js index 7e815df..1ca71c8 100644 --- a/__tests__/ramda-test.js +++ b/__tests__/ramda-test.js @@ -1,10 +1,10 @@ jest.dontMock('../module/'); -import React from 'react/addons'; +import React from 'react'; +import TestUtils from 'react-addons-test-utils'; import R, { __ } from 'ramda'; import { equal } from 'assert'; -const { TestUtils } = React.addons; const { Cond, value, and } = require('../module/'); @@ -15,13 +15,13 @@ describe('React-Cond', () => { it('should render the child component the value is gt the nr', () => { let component = TestUtils.renderIntoDocument( - {[ R.gt(__, 11),

unexpected

]} - {[ R.gt(__, 9),

expected

]} - {[ R.T,

unexpected

]} + {[ R.gt(__, 11),

unexpected

]} + {[ R.gt(__, 9),

expected

]} + {[ R.T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -30,13 +30,13 @@ describe('React-Cond', () => { it('should render the child component the value is lt the nr', () => { let component = TestUtils.renderIntoDocument( - {[ R.lt(__, 10),

unexpected

]} - {[ R.lt(__, 11),

expected

]} - {[ R.T,

unexpected

]} + {[ R.lt(__, 10),

unexpected

]} + {[ R.lt(__, 11),

expected

]} + {[ R.T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -45,13 +45,13 @@ describe('React-Cond', () => { it('should render the child component the value is lte the nr', () => { let component = TestUtils.renderIntoDocument( - {[ R.lte(__, 9),

unexpected

]} - {[ R.lte(__, 10),

expected

]} - {[ R.T,

unexpected

]} + {[ R.lte(__, 9),

unexpected

]} + {[ R.lte(__, 10),

expected

]} + {[ R.T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -60,13 +60,13 @@ describe('React-Cond', () => { it('should render the child component the value is gte the nr', () => { let component = TestUtils.renderIntoDocument( - {[ R.gte(__, 11),

unexpected

]} - {[ R.gte(__, 10),

expected

]} - {[ R.T,

unexpected

]} + {[ R.gte(__, 11),

unexpected

]} + {[ R.gte(__, 10),

expected

]} + {[ R.T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -77,13 +77,13 @@ describe('React-Cond', () => { let component = TestUtils.renderIntoDocument( - {[ notEquals(10),

unexpected

]} - {[ notEquals(11),

expected

]} - {[ R.T,

unexpected

]} + {[ notEquals(10),

unexpected

]} + {[ notEquals(11),

expected

]} + {[ R.T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -92,13 +92,13 @@ describe('React-Cond', () => { it('should render the child component the value is eq the nr', () => { let component = TestUtils.renderIntoDocument( - {[ R.equals(11),

unexpected

]} - {[ R.equals(10),

expected

]} - {[ R.T,

unexpected

]} + {[ R.equals(11),

unexpected

]} + {[ R.equals(10),

expected

]} + {[ R.T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -109,13 +109,13 @@ describe('React-Cond', () => { let component = TestUtils.renderIntoDocument( - {[ between(10, 12),

unexpected

]} - {[ between(9, 11),

expected

]} - {[ R.T,

unexpected

]} + {[ between(10, 12),

unexpected

]} + {[ between(9, 11),

expected

]} + {[ R.T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -128,15 +128,15 @@ describe('React-Cond', () => { let component = TestUtils.renderIntoDocument( - {[ R.allPass([startsWith('-'), endsWith('-')]),

unexpected

]} - {[ R.allPass([startsWith('-'), endsWith('_')]),

unexpected

]} - {[ R.allPass([startsWith('_'), endsWith('-')]),

unexpected

]} - {[ R.allPass([startsWith('_'), endsWith('_')]),

expected

]} - {[ R.T,

unexpected

]} + {[ R.allPass([startsWith('-'), endsWith('-')]),

unexpected

]} + {[ R.allPass([startsWith('-'), endsWith('_')]),

unexpected

]} + {[ R.allPass([startsWith('_'), endsWith('-')]),

unexpected

]} + {[ R.allPass([startsWith('_'), endsWith('_')]),

expected

]} + {[ R.T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -148,15 +148,15 @@ describe('React-Cond', () => { let component = TestUtils.renderIntoDocument( - {[ R.anyPass([startsWith('-'), endsWith('-')]),

unexpected

]} - {[ R.anyPass([startsWith('-'), endsWith('_')]),

expected

]} - {[ R.anyPass([startsWith('_'), endsWith('-')]),

unexpected

]} - {[ R.anyPass([startsWith('_'), endsWith('_')]),

unexpected

]} - {[ R.T,

unexpected

]} + {[ R.anyPass([startsWith('-'), endsWith('-')]),

unexpected

]} + {[ R.anyPass([startsWith('-'), endsWith('_')]),

expected

]} + {[ R.anyPass([startsWith('_'), endsWith('-')]),

unexpected

]} + {[ R.anyPass([startsWith('_'), endsWith('_')]),

unexpected

]} + {[ R.T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); @@ -167,13 +167,13 @@ describe('React-Cond', () => { let component = TestUtils.renderIntoDocument( - {[ and(R.propEq('val1', 11), R.propEq('val2', 12)),

unexpected

]} - {[ and(R.propEq('val1', 12), R.propEq('val2', 13)),

expected

]} - {[ R.T,

unexpected

]} + {[ and(R.propEq('val1', 11), R.propEq('val2', 12)),

unexpected

]} + {[ and(R.propEq('val1', 12), R.propEq('val2', 13)),

expected

]} + {[ R.T,

unexpected

]}
); let val = TestUtils.findRenderedDOMComponentWithTag(component, 'h1'); - equal(val.getDOMNode().textContent, 'expected'); + equal(val.textContent, 'expected'); }); }); diff --git a/package.json b/package.json index 19fcf8d..cc21f34 100644 --- a/package.json +++ b/package.json @@ -36,12 +36,14 @@ "jest-cli": "0.5.8", "nodangel": "1.3.8", "ramda": "0.17.1", - "react": "0.13.3" + "react": "^0.14.2", + "react-addons-test-utils": "^0.14.2" }, "jest": { "scriptPreprocessor": "/node_modules/babel-jest", "unmockedModulePathPatterns": [ "/node_modules/react", + "/node_modules/react-addons-test-utils", "/node_modules/ramda" ], "testFileExtensions": [