Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Add tools for generating a simulated Payment History for testing #4655

Closed
wants to merge 4 commits into from
Closed

Add tools for generating a simulated Payment History for testing #4655

wants to merge 4 commits into from

Conversation

willy-b
Copy link
Contributor

@willy-b willy-b commented Oct 10, 2016

Adds npm script: npm run add-simulated-payment-history

This generates a simulated Payment History, allowing testing of features that depend transactions without spending BTC or waiting.

fixes #4199

Test Plan:

  1. Clear user data (npm run clean userData)
  2. Start Brave
  3. Enable Brave Payments
  4. Observe no transactions, empty wallet, Payment History link is unavailable
  5. Run npm run add-simulated-payment-history
  6. Switch to Brave and Toggle Payments
  7. Observe Payment History link is available
  8. Open Payment History.
  9. Observe 10 months of randomized Payments data
  10. Open /\<UserDataPath\>/ledger-state.json and confirm transactions are present

simulated_payments_history_script

cc @mrose17 , @diracdeltas

Willy Bruns added 3 commits October 9, 2016 18:34
- `js/lib/transactionHelpers.js`: Tools for generating and validating (w/ Joi) Ledger transactions
- `npm run add-simulated-payment-history`: new npm script which generates a simulated payment history, allowing testing related features without spending BTC

fixes #4199
- added informative error message for if /\<UserDataPath\>/ledger-state.json does not exist
- tool scripts spawning Electron can pass stdio argument to utilAppRunner to see Electron logs
- added submissionDate to Joi schema to correct an error
let cmd = 'addSimulatedLedgerTransactions'

// if user has specified number of simulated transactions to add
if (process.argv[3]) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be argv[2] and has been fixed (follow-up commit already in this PR)

@diracdeltas
Copy link
Member

please move js/lib/transactionHelpers.js to tools/lib unless it needs to be used directly by browser front-end

@diracdeltas
Copy link
Member

otherwise lgtm after rebase!

@willy-b
Copy link
Contributor Author

willy-b commented Oct 10, 2016

Sweet.
Yes, transactionHelpers won't be used by front-end.
I am planning on using the transactionHelpers in tests (to replace the hardcoded transaction data and use consistent validation code). But it's OK for tests to depend on stuff in tools/, right?

Thanks for the review, I am rebasing and opening a new PR now

@willy-b
Copy link
Contributor Author

willy-b commented Oct 10, 2016

replaced by PR #4656

@willy-b willy-b closed this Oct 10, 2016
diracdeltas added a commit that referenced this pull request Oct 10, 2016
…199-rebase

Add tools for generating a simulated Payment History for testing (replaces #4655)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sample Ledger data files (ledger-*.json) for testing & development?
2 participants