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

Split PaymentsTab into its own component #6529

Merged
merged 2 commits into from
Jan 26, 2017
Merged

Conversation

jkup
Copy link
Contributor

@jkup jkup commented Jan 5, 2017

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

This ticket both splits PaymentsTab out into its own component and adds automated tests for its functionality.

Fix #6528, fix #5887

@bsclifton I'm not thrilled with my fakeSetting API, can you help me make it a little more scalable? Maybe in another ticket? Eventually I assume we'll need more than just true for all or false for all which is all mine can handle!

Auditors @bsclifton @bbondy @cezaraugusto please let me know what you think!

Test Plan:
npm run unittest -- --grep="Preferences component"

Ready for people to take a look at this! You can change line 15 on paymentsTabTest.js to be describe.only and then with watch-all running you can just run npm run unittest.

#6456 #6455 #6422

@bsclifton
Copy link
Member

bsclifton commented Jan 5, 2017

I tried running this locally (macOS) via npm run unittest and ran into the following:

1) Preferences component loads "before all" hook:
     Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.
      at invariant (node_modules/fbjs/lib/invariant.js:44:15)
      at ReactCompositeComponentWrapper.instantiateReactComponent [as _instantiateReactComponent] (node_modules/react-dom/lib/instantiateReactComponent.js:68:134)
      at ReactCompositeComponentWrapper.performInitialMount (node_modules/react-dom/lib/ReactCompositeComponent.js:367:22)
      at ReactCompositeComponentWrapper.mountComponent (node_modules/react-dom/lib/ReactCompositeComponent.js:258:21)
      at Object.mountComponent (node_modules/react-dom/lib/ReactReconciler.js:46:35)
      at ReactCompositeComponentWrapper.performInitialMount (node_modules/react-dom/lib/ReactCompositeComponent.js:371:34)
      at ReactCompositeComponentWrapper.mountComponent (node_modules/react-dom/lib/ReactCompositeComponent.js:258:21)
      at Object.mountComponent (node_modules/react-dom/lib/ReactReconciler.js:46:35)
      at mountComponentIntoNode (node_modules/react-dom/lib/ReactMount.js:104:32)
      at ReactReconcileTransaction.perform (node_modules/react-dom/lib/Transaction.js:140:20)
      at batchedMountComponentIntoNode (node_modules/react-dom/lib/ReactMount.js:126:15)
      at ReactDefaultBatchingStrategyTransaction.perform (node_modules/react-dom/lib/Transaction.js:140:20)
      at Object.batchedUpdates (node_modules/react-dom/lib/ReactDefaultBatchingStrategy.js:62:26)
      at Object.batchedUpdates (node_modules/react-dom/lib/ReactUpdates.js:97:27)
      at Object._renderNewRootComponent (node_modules/react-dom/lib/ReactMount.js:320:18)
      at Object._renderSubtreeIntoContainer (node_modules/react-dom/lib/ReactMount.js:401:32)
      at Object.render (node_modules/react-dom/lib/ReactMount.js:422:23)
      at Object.renderIntoDocument (node_modules/react-dom/lib/ReactTestUtils.js:79:21)
      at renderWithOptions (node_modules/enzyme/build/react-compat.js:187:26)
      at new ReactWrapper (node_modules/enzyme/build/ReactWrapper.js:94:59)
      at mount (node_modules/enzyme/build/mount.js:19:10)
      at Context.<anonymous> (test/unit/about/preferencesTest.js:40:21)

When I scrolled up to where the test was executed, you can see the additional errors logged via stdout:

Preferences component
    loads
Warning: Failed prop type: The prop `Component` is marked as required in `<<anonymous>>`, but its value is `undefined`.
    in Unknown
Warning: Failed prop type: The prop `props` is marked as required in `<<anonymous>>`, but its value is `undefined`.
    in Unknown
Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components).
      1) "before all" hook

Is there something I missed?

@jkup jkup force-pushed the preferences-tests branch 2 times, most recently from f746c78 to a7e6e75 Compare January 5, 2017 18:59
@jkup
Copy link
Contributor Author

jkup commented Jan 5, 2017

@bsclifton sorry! was messing around with them late last night and made a breaking change. Should be good now although two of the (unrelated) preferencesTest.js tests are broken in master. I'll follow up on those separately with @bbondy.

Copy link
Contributor

@cezaraugusto cezaraugusto left a comment

Choose a reason for hiding this comment

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

@jkup AFAIU this PR only cover tests for payments, correct? Would the split of payments tab component be a follow-up, then?

Current tests LGTM ++

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

Tested it out, everything works as expected (I updated the original post to show a way to only run these ones). Great job! 😄

@bsclifton
Copy link
Member

@cezaraugusto this PR is also breaking the payments tab out from preferences.js into it's own file

@bsclifton
Copy link
Member

If this looks good to you (either @cezaraugusto or @bbondy), please approve using GitHub and then mark with the ready-to-merge label 😄

@cezaraugusto
Copy link
Contributor

ok sorry, GitHub grouped paymentsTab.js which I missed.

LGTM

@luixxiul
Copy link
Contributor

luixxiul commented Jan 8, 2017

Please make sure that there are several PRs which will be possibly conflicted if this is merged first.
See: https://github.com/brave/browser-laptop/pulls?utf8=%E2%9C%93&q=is%3Apr%20is%3Aopen%20label%3Afeature%2Fledger%20-label%3Atests%20-label%3APR%2Fwork-in-progress%20

Could I remove the ready-for-merge label for now, so that this PR will not be merged first? thanks

@bsclifton bsclifton force-pushed the 0.13.1-branch branch 6 times, most recently from 65c7753 to 238cfd3 Compare January 25, 2017 19:19
@bsclifton
Copy link
Member

Rebasing this now... should be a great cleanup 😄

@bsclifton
Copy link
Member

Gonna watch CI on this one; should be good to merge though! 😄

@bsclifton
Copy link
Member

Reran failing tests locally; a few unrelated tests seem to be perma-failing ☹️

I believe it's safe to merge this since the ledger tests are passing and the failing tests are not impacted by these code changes

@bsclifton bsclifton changed the base branch from 0.13.1-branch to master January 26, 2017 18:08
jkup and others added 2 commits January 26, 2017 11:18
…committed)

(no more currency symbols, payment history button now always shows (but will have text saying when next contribution is)

Auditors: @bbondy, @mrose17
@bsclifton bsclifton merged commit fb5b958 into master Jan 26, 2017
@bsclifton bsclifton deleted the preferences-tests branch January 26, 2017 18:22
@bsclifton bsclifton restored the preferences-tests branch January 26, 2017 19:06
bsclifton added a commit that referenced this pull request Jan 26, 2017
@luixxiul luixxiul removed this from the 0.13.1 milestone Jan 27, 2017
@bsclifton bsclifton added this to the 0.13.1 milestone Jan 30, 2017
@bsclifton
Copy link
Member

re-assigned 0.13.1 milestone after merge was redone properly

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.

Split PaymentsTab into its own component Add unit tests for ledger backup and minimum visits
5 participants