Our development objectives and open issues are all public on GitHub issues. Pull requests are welcome!
Optionally, you can install ZenHub plugin (available on Chrome and Firefox) to see development plan board, see issues already in progress etc.
The development build (npm start
) will also start docs build (esdoc). This docs build will compile all components docs and show a webpage. To access it just:
$ npm start
- Access url
http://localhost:3000/
Docs
- Access url
http://localhost:3000/esdoc/
Other options are:
$ npm run prod
$ npm run build
$ npm install -g jest
$ npm run test
If you get error with jest, try running jest --no-cache
This mode does not call the geoserver, instead it simulates geoserver calls.
$ npm run mock
The tests environment was made using jest and enzyme. At first, we're doing the following test types:
- Component rendering with Snapshot test. Example:
import React from 'react';
import App from '../../src/components/App/App.js';
import renderer from 'react-test-renderer';
it('component renders correctly', () => {
const app = shallow(<App/>);
expect(app).toMatchSnapshot();
});
- Property tests (props)
- Events tests
$ npm run test
: run all tests
$ npm run test:watch
: run all tests right now and also when some component change
$ npm run test:coverage
: run all tests and show coverage information
We use JSDoc to document components. For each component we write:
- Basic description of what the component is, soon after component class declaration, write the description with a comment:
/** * App component that represents the application */
- What every component method does and what it returns, right after module declaration
/** * renders the element * @return html markup of the element */
Just like on following example, with App class.
import React from 'react';
import Input from '../input/Input.js';
require('./app.scss');
/**
* App component that represents the application
*/
export default class App extends React.Component {
/**
* renders the element
* @return html markup of the element
*/
render() {
return (
<div style={{textAlign: 'center'}} className="module-app">
<h1>Hello World</h1>
<Input />
<hr />
</div>
);
}
}