2019-04-26 14:15:26 +03:00
# fxa-payments-server
This is the server that handles payments.
2019-07-02 21:32:28 +03:00
## Storybook
This project uses [Storybook ](https://storybook.js.org/ ) to show each screen without requiring a full stack.
2020-06-18 04:13:10 +03:00
You can view the Storybook built from the most recent main at http://mozilla.github.io/fxa/fxa-payments-server/
2019-07-02 21:32:28 +03:00
2021-01-20 05:23:27 +03:00
In local development, `yarn storybook` should start a Storybook server at < http: // localhost:6006 > with hot module replacement to reflect live changes.
2020-02-04 23:55:53 +03:00
2019-07-09 00:06:28 +03:00
## Installation notes
2021-01-20 05:23:27 +03:00
On Mac OS, `yarn test` may trigger an `EMFILE` error. In this case, to get tests running, you may need to `brew install watchman` . (If the watchman postinstall step fails, follow the instructions [here ](https://stackoverflow.com/a/41320226 ) to change `/usr/local` ownership from root to your user account.)
2019-07-09 00:06:28 +03:00
2020-03-18 19:26:54 +03:00
## Secrets
Create the following file: `server/config/secrets.json` . It will not be tracked in Git.
Use the following as a template, and fill in your own values:
```json
{
"stripe": {
"apiKey": "pk_test_123"
}
}
```
- `apiKey` should be a test Stripe Publishable Key
2020-05-06 04:56:47 +03:00
## Testing
2021-01-20 05:23:27 +03:00
This package uses [Jest ](https://jestjs.io/ ) to test both the frontend and server. By default `yarn test` will run all yarn test scripts:
2020-05-06 04:56:47 +03:00
2021-01-20 05:23:27 +03:00
- `yarn test:frontend` will test the React App frontend under `src/`
- `yarn test:server` will test the Express server under `server/`
2020-05-06 04:56:47 +03:00
Test specific tests with the following commands:
```bash
# Test frontend tests for the component AlertBar
2021-01-20 05:23:27 +03:00
yarn test:frontend AlertBar
2020-05-06 04:56:47 +03:00
# Grep frontend tests for "renders as expected"
2021-01-20 05:23:27 +03:00
yarn test:frontend -t "renders as expected"
2020-05-06 04:56:47 +03:00
# Test server tests for the file server/lib/csp
2021-01-20 05:23:27 +03:00
yarn test:server server/lib/csp
2020-05-06 04:56:47 +03:00
# Grep server tests for "logs raw events"
2021-01-20 05:23:27 +03:00
yarn test:server -t "logs raw events"
2020-05-06 04:56:47 +03:00
```
2021-01-20 05:23:27 +03:00
Note that prior to testing you may need to create a build of the React App. You can do this by running `yarn build` .
2020-05-06 04:56:47 +03:00
Refer to Jest's [CLI documentation ](https://jestjs.io/docs/en/cli ) for more advanced test configuration.
2019-04-26 14:15:26 +03:00
## License
2019-07-02 21:32:28 +03:00
MPL-2.0