Set up Jest tests for React-Redux (#332)

This commit is contained in:
kagehina919 2018-11-14 22:20:37 +05:30 коммит произвёл William Lachance
Родитель 699b9cd277
Коммит 1ef76ba964
6 изменённых файлов: 1245 добавлений и 96 удалений

Просмотреть файл

@ -16,5 +16,6 @@ module.exports = {
use: [ use: [
'neutrino-preset-mozilla-frontend-infra/react', 'neutrino-preset-mozilla-frontend-infra/react',
['@neutrinojs/env', Object.keys(envs)], ['@neutrinojs/env', Object.keys(envs)],
'@neutrinojs/jest'
] ]
}; };

Просмотреть файл

@ -40,6 +40,12 @@ yarn start
This should start up a webserver at http://localhost:5000 which you can connect to. This should start up a webserver at http://localhost:5000 which you can connect to.
To run the [Jest](https://jestjs.io/) tests for Mission Control's React components, execute:
```bash
yarn test
```
Instructions for development (full stack) Instructions for development (full stack)
----------------------------------------- -----------------------------------------

Просмотреть файл

@ -13,6 +13,7 @@ printf '{"commit":"%s","version":"%s","source":"https://github.com/%s/%s","build
echo "Building frontend" echo "Building frontend"
yarn install yarn install
SERVICE_DOMAIN="" yarn build SERVICE_DOMAIN="" yarn build
yarn test
echo "Building the docker image with the tag app:build" echo "Building the docker image with the tag app:build"
docker build -t app:build . docker build -t app:build .

Просмотреть файл

@ -0,0 +1,16 @@
import rootReducer from '../../reducers';
import { REQUEST_CHANNEL_PLATFORM_SUMMARY_DATA } from '../../actions';
describe('channelPlatformSummary reducer', () => {
it('Requests channel platform summary data', () => {
const initialState = {};
const action = { type: REQUEST_CHANNEL_PLATFORM_SUMMARY_DATA };
const expectedState = {
channelPlatformSummary: { isFetching: true },
measures: {},
};
const receivedState = rootReducer(initialState, action);
expect(expectedState).toEqual(receivedState);
});
});

Просмотреть файл

@ -7,9 +7,10 @@
"coverage": "neutrino test --coverage" "coverage": "neutrino test --coverage"
}, },
"devDependencies": { "devDependencies": {
"enzyme": "^2.8.2", "@neutrinojs/jest": "^8.3.0",
"enzyme": "^3.7.0",
"eslint-plugin-react": "^7.1.0", "eslint-plugin-react": "^7.1.0",
"react-addons-test-utils": "^15.5.1" "react-addons-test-utils": "^15.6.2"
}, },
"dependencies": { "dependencies": {
"@neutrinojs/env": "^8.2.0", "@neutrinojs/env": "^8.2.0",

1312
yarn.lock

Разница между файлами не показана из-за своего большого размера Загрузить разницу