@mvf/servicer v5.9.4
Servicer package
Usage
To install the package
Run npm install @mvf/servicer
Contributing
Setup
- Run
maketo build the container - Run
make shellto enter the container - Run
npm installto install dependencies
Refer to package.json for commands
After merging
After you have merged a PR to master, you need to rebuild and publish your changes.
- Checkout master
git checkout master && git pull - Use one of the following make publish commands to publish changes:
make publish kind=patch- Use this if your change is a bug fix and is backwards compatible.make publish kind=minor- Use this if your change adds new functionality and is backwards compatible.make publish kind=major- Use this if your change is not backwards compatible.
Setup Tests
- In RestEvents, CommandEvents or BackendEvents, add import
bindSimulator:import { bindSimulator } from '@mvf/servicer';
- Then use
bindSimulatorto create asimulatefunction:export const simulate = bindSimulator(RestEvents);
- In the tests it is then possible to call actions using the simulate function:
const result = await simulate(ActionConstant, { headers }, { body });
Success response
const result = await simulate(ActionConstant, { headers }, { body });
result.output.output; // will contain response from ActionError response
Response with Status code & Error message
const err = await catchAsyncError(async () => {
await simulate(ActionConstant,{headers},{body});
});
expect(err.status).toBe(400);
expect(err.message).toBe('Error message');Response with type of error
await expect(simulate(ActionConstant, {headers}, {body})).rejects.toThrow(BadRequestError);12 months ago
7 months ago
7 months ago
7 months ago
8 months ago
12 months ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago