Skip to content

Commit

Permalink
feature/react-16 (#80)
Browse files Browse the repository at this point in the history
* bump react version to 16

* fix client specs... (+ enzyme adapter)

* fix react warning (requestAnimationFrame) on tests

* upgrade packages (patched versions)

* updage packages (minor versions)

* update README
- tweet message + hashtags
- react v16

* update setup.md doc
  • Loading branch information
carloluis authored Nov 22, 2017
1 parent 37346e0 commit e805992
Show file tree
Hide file tree
Showing 13 changed files with 1,843 additions and 1,242 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![GitHub release](https://img.shields.io/github/release/uruit/react-seed.svg)](https://github.com/UruIT/react-seed/releases)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md#pull-requests)
[![Twitter Follow](https://img.shields.io/twitter/follow/uruit.svg?style=social&label=Follow)](https://twitter.com/UruIT/followers)
[![Twitter URL](https://img.shields.io/twitter/url/http/uruit.react-seed.svg?style=social)](https://twitter.com/intent/tweet?text=react-seed%20by%20%40UruIT%20on&url=https%3A%2F%2Fgithub.com%2Furuit%2Freact-seed)
[![Twitter URL](https://img.shields.io/twitter/url/http/uruit.react-seed.svg?style=social)](https://twitter.com/intent/tweet?text=react-seed%20by%20%40UruIT%20on&url=https%3A%2F%2Fgithub.com%2Furuit%2Freact-seed&hashtags=react,uruit,dev,seed)

[![DevDependencies](https://img.shields.io/david/dev/uruit/react-seed.svg)](https://github.com/uruit/react-seed/blob/master/package.json)

Expand All @@ -19,7 +19,7 @@ UruIT seed project for ReactJS applications
* Webpack
* ES6/7
* ESLint
* React
* React 16
* Fetch
* React-Router
* Jest
Expand Down
5 changes: 5 additions & 0 deletions client/__setup__/enzyme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import './shim';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

Enzyme.configure({ adapter: new Adapter() });
3 changes: 3 additions & 0 deletions client/__setup__/shim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const raf = (global.requestAnimationFrame = cb => setTimeout(cb, 0));

export default raf;
5 changes: 3 additions & 2 deletions client/components/app/App.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react';
import { shallow, mount } from 'enzyme';
import ShallowRenderer from 'react-test-renderer/shallow';
import { shallow, mount } from 'enzyme';

import { getJson } from 'utils/fetch';
import Clickable from '../clickable';
import App from './App';
import links from '../../routes/links';
import App from './App';

jest.mock('utils/fetch', () => ({
getJson: jest.fn(url => new Promise((resolve, reject) => (url ? resolve({ value: 'another joke' }) : reject())))
Expand Down
4 changes: 1 addition & 3 deletions client/components/app/__snapshots__/App.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ exports[`<App/> snapshot 1`] = `
</button>
<div
className="jokes"
>
</div>
/>
<Clickable
content={
<div
Expand Down
2 changes: 1 addition & 1 deletion client/components/clickable/Clickable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styles from './clickable.scss';

const Clickable = ({ content, onClick }) => (
<div className={styles.container} onClick={onClick}>
{ content }
{content}
</div>
);

Expand Down
3 changes: 2 additions & 1 deletion client/components/clickable/Clickable.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import Clickable from './Clickable';
import renderer from 'react-test-renderer';
import { shallow } from 'enzyme';

import Clickable from './Clickable';

describe('<Clickable/>', () => {
it('snapshot - default props', () => {
const tree = renderer.create(<Clickable />).toJSON();
Expand Down
1 change: 1 addition & 0 deletions client/components/counter/Counter.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import ShallowRenderer from 'react-test-renderer/shallow';
import { shallow } from 'enzyme';

import Counter from './Counter';

describe('<Counter/>', () => {
Expand Down
4 changes: 3 additions & 1 deletion client/components/counter/__snapshots__/Counter.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ exports[`<Counter/> snapshot 1`] = `
>
<div
className="value"
/>
>
0
</div>
<div
className="controls"
>
Expand Down
15 changes: 10 additions & 5 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@
"dependencies": {
"es6-promise": "^4.1.1",
"prop-types": "^15.5.9",
"react": "^15.5.4",
"react-dom": "^15.5.4",
"react": "^16.1.1",
"react-dom": "^16.1.1",
"react-router-dom": "^4.2.0",
"whatwg-fetch": "^2.0.3"
},
"devDependencies": {
"babel-preset-react-hmre": "^1.1.1",
"enzyme": "^2.9.1",
"jest": "^20.0.0",
"react-test-renderer": "^15.6.1"
"enzyme": "^3.2.0",
"enzyme-adapter-react-16": "^1.1.0",
"jest": "^21.2.1",
"react-test-renderer": "^16.1.1"
},
"jest": {
"moduleNameMapper": {
Expand All @@ -36,6 +37,10 @@
"testPathIgnorePatterns": [
"/node_modules/",
"webpack"
],
"setupFiles": [
"<rootDir>/__setup__/shim.js",
"<rootDir>/__setup__/enzyme.js"
]
}
}
Loading

0 comments on commit e805992

Please sign in to comment.