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

Commit

Permalink
Adds lower amount into monhtly budget
Browse files Browse the repository at this point in the history
Resolves #12465

Auditors:

Test Plan:
  • Loading branch information
NejcZdovc committed Jan 3, 2018
1 parent 1bcc802 commit bde696f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
3 changes: 1 addition & 2 deletions app/browser/api/ledger.js
Original file line number Diff line number Diff line change
Expand Up @@ -1797,12 +1797,11 @@ const initialize = (state, paymentsEnabled) => {
const getContributionAmount = () => {
let amount = parseInt(getSetting(settings.PAYMENTS_CONTRIBUTION_AMOUNT), 10)

// if amount is 5, 10, 15, or 20... the amount wasn't updated when changing
// if amount is 5, 15, or 20... the amount wasn't updated when changing
// from BTC to BAT (see https://github.com/brave/browser-laptop/issues/11719)
let updatedAmount
switch (amount) {
case 5: updatedAmount = 25; break
case 10: updatedAmount = 50; break
case 15: updatedAmount = 75; break
case 20: updatedAmount = 100; break
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class EnabledContent extends ImmutableComponent {
value={getSetting(settings.PAYMENTS_CONTRIBUTION_AMOUNT, this.props.settings)}
onChange={changeSetting.bind(null, this.props.onChangeSetting, settings.PAYMENTS_CONTRIBUTION_AMOUNT)}>
{
[25, 50, 75, 100].map((amount) => {
[10, 25, 50, 75, 100].map((amount) => {
let alternative = ''
if (ledgerData.has('currentRate')) {
const converted = batToCurrencyString(amount, ledgerData)
Expand Down
14 changes: 0 additions & 14 deletions test/unit/app/browser/api/ledgerTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,20 +290,6 @@ describe('ledger api unit tests', function () {
assert(onChangeSettingSpy.withArgs(settings.PAYMENTS_CONTRIBUTION_AMOUNT, 25).calledOnce)
})
})
describe('when set to 10 USD', function () {
before(function () {
setPaymentInfoSpy.reset()
onChangeSettingSpy.reset()
contributionAmount = 10
ledgerApi.onInitRead(defaultAppState, parsedLedgerData)
})
it('converts to 50 BAT', function () {
assert(setPaymentInfoSpy.withArgs(50).calledOnce)
})
it('updates the setting', function () {
assert(onChangeSettingSpy.withArgs(settings.PAYMENTS_CONTRIBUTION_AMOUNT, 50).calledOnce)
})
})
describe('when set to 15 USD', function () {
before(function () {
setPaymentInfoSpy.reset()
Expand Down

0 comments on commit bde696f

Please sign in to comment.