Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More unit tests and some code cleanup (#87)
* Tests converted to Jest * Added rules engine jsonpath dynamic fact * Updated rules engine API. Added jsonpath package to dependencies. Added rules engine tests. Added Jest config. Added example rules.json. * Updated hapi/subtext to patch vulnerability * Updated example rules and corresponding tests to reflect real form of payer and payee * Added switch endpoint to config to obtain payer and payee information for rules engine. Stubbed validateQuoteRequest method in relevant tests. Running rules engine in validateQuoteRequest (but not doing anything with the results yet). * Tests converted to Jest * Replaced coverage-check script. Added coverage threshold to jest config. Removed Istanbul config. * Uninstalled and reinstalled jest to fix vulnerability * Added junit + config. Added test:junit npm script. Modified circle config to call junit script. Added test results directory to gitignore. * Modified example rules and corresponding tests to better reflect actual payer and payee facts * Updated redirect address to redirect fsp. Made the linter happy. Added rule execution and event handling. Removed empty quote validation, replaced with rules engine execution. Removed redundant setImmediate. New test for INVALID_QUOTE_REQUEST event. Expanded INVALID_QUOTE_REQUEST unit tests. * Manual merge from upstream * Integrated properly the new `model/rules.js` into `model/quotes.js` and updated the `quotes.tests.js` accordingly. * Simplified block of code that was unnecessarily using `map`. * Forwarding event-handler-modified quote request and headers instead of originals * Fixed tests by poorly mocking handleRuleEvents on the quotes model * Cleaned a little bit the result of `handleRuleEvents`; Updated unit tests in order to pass according to latest code changes. * Deduplicated the functionality of request sending * Removed `setImmediate` from all places that it was used. * Use `CreateInternalServerFSPIOPError` instead of `CreateFSPIOPError` * fixed the name of rules.json * rename file rules.example.json * Refactored existing unit tests in order to make them cleaner and avoid duplication; Added more unit tests for `handleQuoteRequest` to cover all possible paths. * Refactored `handleQuoteRequest` to make it more readable and avoid duplication; Cleaned some minor parts of the whole `quotes.js` file. * Resolved issue with merge * Added unit tests for `quotesModel.handleRuleEvents` * Minor update to behaviour and corresponding test update. Minor test change. * Lint fix * Added unit tests for `quotesModel.executeRules` * Added more unit tests to `quotesModel.executeRules` to cover rejected promises of `axios.request` * Minor refactoring on the unit tests of `RulesEngine` to use `describe` blocks and `it()` instead of `test()` for consistency. * Added missing dependency that got removed after merging. * Updated quotes model unit tests to match the new implementation of config.js * Updated comments in codebase. * Removed ``^` sign from dependency in package.json
- Loading branch information