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

Payment History receipt filenames for transactions with same date get unique suffix (#4605) #4632

Merged
merged 2 commits into from
Oct 10, 2016
Merged

Payment History receipt filenames for transactions with same date get unique suffix (#4605) #4632

merged 2 commits into from
Oct 10, 2016

Conversation

willy-b
Copy link
Contributor

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

Test Plan:

  1. Enable Brave Payments, create wallet, fund it (use testnet if you want to save BTC)
  2. Trigger reconciliation multiple times by editing //ledger-state.json reconcileStamp to be in past (e.g. set to 100)
  3. Open Brave Payments -> Payment History
  4. Observe "Receipt Link" column
  5. Receipt filenames should all be unique
  6. All Receipt filenames after the 1st for a given day should end in "${n}.csv", like "Brave_Payments${MM-D(D)-YYYY}_${n}.csv" (where n=2 for the 2nd transaction on that day, n=3 for 3rd
  7. Unit tests verifying this should be present and passing

To check unit tests, run:

NODE_ENV=test mocha --compilers js:babel-register --recursive test/unit/lib/ledgerExportUtilTest.js

and check the block of tests beginning w/ addExportFilenamePrefixToTransactions

Willy Bruns added 2 commits October 8, 2016 07:26
…ansactions occur in same day

Receipt filenames for the Nth transaction in a given day have a suffix `_N` added when N > 1
e.g. for two transactions occur on 10/7/2016, the 2nd filename will be `Brave_Payments_10-7-2016_2.csv`

fixes #4605
tests for #4605 (#4605)
```
addExportFilenamePrefixToTransactions
  ✓ should return an empty array if not passed any transactions (empty array, null, or undefined input
  ✓ should return the same output for a single transaction given as an array or single object
  ✓ should add a field "exportFilenamePrefix" to each transaction with correct form ("Brave_Payments_${MM)-YYYY}")
  ✓ should add a distinct suffix ("_<n>") to "exportFilenamePrefix" when multiple transactions occur on same day to ensure the field value is unique
```
@diracdeltas
Copy link
Member

++ thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Payment History modal receipt filenames should handle multiple same-day transaction edge case
3 participants