Set up Jest tests for React-Redux (#332)
This commit is contained in:
Родитель
699b9cd277
Коммит
1ef76ba964
|
@ -16,5 +16,6 @@ module.exports = {
|
|||
use: [
|
||||
'neutrino-preset-mozilla-frontend-infra/react',
|
||||
['@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.
|
||||
|
||||
To run the [Jest](https://jestjs.io/) tests for Mission Control's React components, execute:
|
||||
|
||||
```bash
|
||||
yarn test
|
||||
```
|
||||
|
||||
Instructions for development (full stack)
|
||||
-----------------------------------------
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ printf '{"commit":"%s","version":"%s","source":"https://github.com/%s/%s","build
|
|||
echo "Building frontend"
|
||||
yarn install
|
||||
SERVICE_DOMAIN="" yarn build
|
||||
yarn test
|
||||
|
||||
echo "Building the docker image with the tag 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"
|
||||
},
|
||||
"devDependencies": {
|
||||
"enzyme": "^2.8.2",
|
||||
"@neutrinojs/jest": "^8.3.0",
|
||||
"enzyme": "^3.7.0",
|
||||
"eslint-plugin-react": "^7.1.0",
|
||||
"react-addons-test-utils": "^15.5.1"
|
||||
"react-addons-test-utils": "^15.6.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@neutrinojs/env": "^8.2.0",
|
||||
|
|
1312
yarn.lock
1312
yarn.lock
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче