This repository has been archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 974
Add tests for Ledger export utilities (and fix bugs) (rebased #4429) #4436
Merged
diracdeltas
merged 1 commit into
brave:master
from
willy-b:ledger-export-util-tests-rebase-again
Oct 2, 2016
Merged
Add tests for Ledger export utilities (and fix bugs) (rebased #4429) #4436
diracdeltas
merged 1 commit into
brave:master
from
willy-b:ledger-export-util-tests-rebase-again
Oct 2, 2016
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Fixes and miscellaneous: - add example Ledger transaction data: `test/unit/lib/exampleLedgerData.js` - fix how `ledgerExportUtil.js#transactionsToCSVDataURL` handled empty input - use es6 object property notation in `ledgerExportUtil.js` (re: #4346 (comment)) Tests (re: #4346 (comment)): ``` example transaction data ("exampleLedgerData.js") ✓ there should be example transactions to test with ✓ the first example transaction should have a "ballots" object ✓ the first example transaction's "ballots" object should contain >= 1 publisher / vote-count KV pairs transactionsToCSVDataURL ✓ returns a properly formatted data URL string with expected content-type (text/csv) ✓ for empty input, returns a CSV data URL containing only a header row ✓ given transactions, it returns a data URL containing the expected CSV getTransactionCSVText ✓ for empty input, returns a CSV string containing only the expected header row ✓ returns a CSV with the expected header row up to variable currency column ✓ returns a CSV with the same number of columns in every row ✓ returns a CSV with expected data types for each column in every row ✓ returns same CSV for an array containing one transaction and a single transaction object ✓ given a transaction, returns a CSV containing the right number of rows: 1 header row, 1 row per publisher, and if addTotalRow===true, 1 row with totals ✓ returns CSV text matching the CSV rows returned by getTransactionCSVRows ✓ when argument addTotalRow===true, there should be a total row with correct totals for each numeric column getTransactionCSVRows ✓ for empty input, returns an array containing only the expected CSV header row ✓ returns a CSV row array, where the first row is the expected header row up to the currency column (which varies) ✓ returns a CSV row array with the same number of columns in every row ✓ returns a CSV row array with expected data types for each column in every row ✓ returns the same output for a single transaction input as an array of 1 element and a plain transaction object ✓ given a transaction, returns an array containing the right number of CSV rows: 1 header row, 1 row per publisher, and if addTotalRow===true, 1 row with totals ✓ when argument addTotalRow===true, there should be a total row with correct totals for each numeric column getPublisherVoteData ✓ should return a publisher data object with 1 key per publisher ✓ the sum of the "fraction" value across all publisher entries should be 1 ✓ the sum of the "votes" value across all publisher entries should be equal to the overall "votes" entry for the transaction object given as input each publisher value ✓ should have "votes" (type number, >= 0) defined ✓ should have "fraction" (type number, >= 0) defined ✓ should have "contribution" (type object) defined each publisher->contribution entry ✓ should have "satoshis" (type number, >= 0) defined ✓ should have "fiat" (type number, >= 0) defined ✓ should have "currency" (type string) defined getTransactionsByViewingIds ✓ given a single viewingId as a string, it returns an array containing just that transaction (if it exists) ✓ given viewingIds as an array, it filters a transactions array for those transactions getTotalContribution ✓ returns a total contribution object total contribution object ✓ has a key "satoshis" with value of type number (>= 0) ✓ has a key "fiat" associated with an object containing two subkeys, "amount" (number) and "currency" (string) ✓ has a key, fee with value of type number (>= 0) ``` Auditor: @diracdeltas
2 tasks
@willy-b great job with the tests 😄 |
@bsclifton thanks, these are just unit tests though. Still no automated integration / UI tests for Payment History, that's next. |
@willy-b unit tests are just as important as web driver tests, IMO- they complement each other very nicely. Unit tests are great for ensuring the code is working as expected and web driver tests are great for ensuring behaviors we expect still work (preventing regressions). Keep it up 😄 |
This was referenced Oct 4, 2016
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
git rebase -i
to squash commits (if needed).Replaces #4429 .
Follow-up to #4332 and #4346 (comment)
Test Plan:
ledgerExportUtilTest.js
with:ledgerExportUtilTest
tests running & passing