Skip to content

Commit

Permalink
Adding end to end testing
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed Jun 10, 2018
1 parent bd29e5a commit 30b5750
Show file tree
Hide file tree
Showing 8 changed files with 1,830 additions and 27 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ This will print:
null
```

## Testing

To test the component, run `npm test`.

End to end tests are performed with the help of Puppeteer. Unit tests are provided as well. At the time, Puppeteer only runs as expected with `{ headless: false }`.

Note that in order to prevent bloatware from reaching the development `node_modules` folder, a separate `package.json` file is used on the `spec` folder.

## About

The present library is a work of Jordi Moraleda and Joel Moreno
4 changes: 2 additions & 2 deletions example/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ ${JSON.stringify(result, null, 2)}

// Check a response
const merchantParams =
"eyJEc19EYXRlIjoiMjglMkYwNSUyRjIwMTgiLCJEc19Ib3VyIjoiMTAlM0E0NCIsIkRzX1NlY3VyZVBheW1lbnQiOiIxIiwiRHNfQW1vdW50IjoiNjcwMCIsIkRzX0N1cnJlbmN5IjoiOTc4IiwiRHNfT3JkZXIiOiIwMDAwRkI5QTE3MiIsIkRzX01lcmNoYW50Q29kZSI6IjMzNjcwNDY1NSIsIkRzX1Rlcm1pbmFsIjoiMDAxIiwiRHNfUmVzcG9uc2UiOiIwMDAwIiwiRHNfVHJhbnNhY3Rpb25UeXBlIjoiMCIsIkRzX01lcmNoYW50RGF0YSI6IiIsIkRzX0F1dGhvcmlzYXRpb25Db2RlIjoiMjE4MDQ4IiwiRHNfQ29uc3VtZXJMYW5ndWFnZSI6IjEiLCJEc19DYXJkX0NvdW50cnkiOiI3MjQiLCJEc19DYXJkX0JyYW5kIjoiMSJ9";
const signature = "3Fg6oB4URw8ykL-hkvdYPW4RKvT3ikz6qAv6WMHFH2I=";
"eyJEc19EYXRlIjoiMTAlMkYwNiUyRjIwMTgiLCJEc19Ib3VyIjoiMjAlM0EyNiIsIkRzX1NlY3VyZVBheW1lbnQiOiIwIiwiRHNfQW1vdW50IjoiNjAwMCIsIkRzX0N1cnJlbmN5IjoiOTc4IiwiRHNfT3JkZXIiOiIwMDAwNTg0NDFDMCIsIkRzX01lcmNoYW50Q29kZSI6IjM0NjM4MTkwOCIsIkRzX1Rlcm1pbmFsIjoiMDAxIiwiRHNfUmVzcG9uc2UiOiI5OTE1IiwiRHNfTWVyY2hhbnREYXRhIjoiIiwiRHNfVHJhbnNhY3Rpb25UeXBlIjoiMCIsIkRzX0NvbnN1bWVyTGFuZ3VhZ2UiOiIxIiwiRHNfRXJyb3JDb2RlIjoiU0lTOTkxNSIsIkRzX0F1dGhvcmlzYXRpb25Db2RlIjoiKysrKysrIn0=";
const signature = "LQDIuaVKbZx2pXe0nvr4EQ2snHuPyjcLtAzEgcyv8hc=";
const invalidSignature = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa=";

result = pos.checkResponseParameters(merchantParams, signature);
Expand Down
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "redsys-pos",
"version": "1.0.0-beta4",
"version": "1.0.0",
"description": "Node JS library to ease the communication with RedSys point of sales",
"main": "src/index.js",
"scripts": {
"precommit": "lint-staged",
"test": "mocha spec/*"
"test": "cd spec && npm i && npm t"
},
"keywords": [
"redsys",
Expand All @@ -29,11 +29,9 @@
},
"devDependencies": {
"babel-eslint": "^8.2.3",
"chai": "^4.1.2",
"eslint": "^4.19.1",
"husky": "^0.14.3",
"lint-staged": "^7.0.0",
"mocha": "^3.3.0",
"prettier": "^1.13.0"
},
"lint-staged": {
Expand Down
Loading

0 comments on commit 30b5750

Please sign in to comment.