A Boilerplate for ReactJS + Webpack 4 + React Router 4 and Redux
Tech used:
clone the repo using SSH:
git clone git@github.com:ricpumanes/react-webpack-boilerplate.git
or
clone the repo using HTTPS:
git clone https://github.com/ricpumanes/react-webpack-boilerplate.git
install dependencies
npm install
start the app locally (development mode):
npm run dev
build (production mode):
npm run prod
test:
npm test
watch test:
npm run test:watch
Testing Async (with Feathers JS):
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk'; // if you are using thunk middleware
import * as actions from 'path-to-module-actions';
import app from 'path-to-my-feathers-config';
const middlewares = [thunk];
const mockStore = configureStore(middlewares);
const store = mockStore();
const userAccount = {
email: '[email protected]',
password: '12345678',
};
describe("Login Async Action", () => {
it("should return AUTH_LOGIN_SUCCESS if Login was successful", () => {
const expected = [
{ type: 'AUTH_LOGIN', payload: userAccount },
{ type: 'AUTH_LOGIN_SUCCESS', payload: userAccount },
];
// stab the service
app.authenticate = jest.fn(() => {
return Promise.resolve();
});
return store.dispatch(actions.login(userAccount)).then(() => {
expect(store.getActions()).toEqual(expected);
});
});
});
Simulate Production Build
1. build project first
npm run prod
2. generate self-signed certificates (key and cert)
openssl req -nodes -new -x509 -keyout server.key -out server.cert
3. simulate
npm run simulate
Finally, open on app on https://localhost:5000 or on the PORT you set
TODO: