Sample project or task for a job application for an online money transfer provider.
- Git
- Node v10+
- Visual Studio Code
Clone repository
git clone git@github.com:stormwild/serapay.git
cd serapay
Install dependencies and compile TypeScript files
npm i
npm run build
Run tests
npm test
Sample test output
$ npm run test
> serapay@1.0.0 test /path/to/serapay
> nyc mocha -r ts-node/register src/**/*.spec.ts
Config class
✓ should make successful api calls (1599ms)
✓ should return ICashIn when cashIn is invoked
✓ should return ICashOutNatural when cashOutNatural is invoked
✓ should return ICashOutJuridical when cashOutJuridical is invoked
4 passing (2s)
-----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
-----------|----------|----------|----------|----------|-------------------|
All files | 96.43 | 60 | 87.5 | 95.45 | |
config.ts | 96.43 | 60 | 87.5 | 95.45 | 40 |
-----------|----------|----------|----------|----------|-------------------|
Link to path
npm link
Run from command line
serapay
Sample output
$ serapay
Usage: serapay [options] <path>
Commandline tool that computes commission fees from cash transactions provided in a .json file
Options:
-V, --version output the version number
-i, --input <string> path to json input file
-h, --help output usage information
Run from build
npm start
Sample output
$ npm start
> serapay@1.0.0 start /Users/stormwild/Source/paysera/cliapp/serapay
> node ./dist/index.js
Please provide a path to an input file!
Build the application
npm i
npm run build
npm link
Run with the sample data. Make sure you are within the application root folder
serapaycli ./data/input.json
Output
0.06
0.90
87.00
3.00
0.30
0.30
5.00
0.00
0.00
Build the application
npm run build
Run with sample data
npm run start ./data/input.json
Alternatively
node ./dist/serapaycli.js ./data/input.json
Output
0.06
0.90
87.00
3.00
0.30
0.30
5.00
0.00
0.00
Computation seems to be working correctly
- Completed unit test for Config class which wraps config api
- Started command line setup
- Created class as a wrapper for the commission configuration api.