mock-js
Mock server for GoodData UI applications (Analytical Designer and Dashboards).
How to use:
Install bear-js from private repository:
yarn install --save-dev @gooddata/bear-js
Create your mock-schema.json
file:
{
"project": {
"title": "My mocked project"
},
"groups": [{
"attributes": [{
"title": "Account",
"elements": ["1", "2", "3"]
}],
"dateDataSets": [{
"title": "Activity"
}, {
"title": "Opportunity"
}, {
"title": "Closed"
}],
"metrics": [{
"title": "# Won"
}, {
"title": "# Closed"
}],
}, {
"meta": {
"type": "csv",
"identifier": "dataset.1"
},
"attributes": [{
"title": "Attribute A"
}, {
"title": "Attribute B"
}],
"metrics": [{
"title": "Metric A"
}, {
"title": "Metric B"
}]
}]
}
Register bear-js
middleware:
const register = require('@gooddata/bear-js');
const schema = require('./mock-schema.json');
module.exports = {
createMiddleware: function createMiddleware(webpackConfig, webpackOptions) {
return (app) => {
return register.default(app, { schema });
};
}
};
Development
Project setup
yarn install
Building project (with watch)
yarn dev
Running test suite:
yarn test
Running tslint
yarn validate