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

Commit

Permalink
Merge pull request #12473 from NejcZdovc/hotfix/#12465-amount
Browse files Browse the repository at this point in the history
 Adds lower amount into monthly budget
  • Loading branch information
bsclifton committed Jan 3, 2018
1 parent 45e8c5f commit b3377bc
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 18 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 @@ -299,7 +299,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
2 changes: 1 addition & 1 deletion tools/lib/transactionHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const generateSurveyorIds = function (count) {
}

const generateContribution = function () {
let randomContributionAmount = [25, 50, 75, 100][ Math.round(Math.random() * 3) ]
let randomContributionAmount = [10, 25, 50, 75, 100][ Math.round(Math.random() * 3) ]
const currency = 'BAT'

let rates = {
Expand Down

0 comments on commit b3377bc

Please sign in to comment.