From 320b65a8bb94abf2a77b1bc92ecdbef65a0ad96f Mon Sep 17 00:00:00 2001 From: NejcZdovc Date: Tue, 23 Jan 2018 23:16:26 +0100 Subject: [PATCH] Removes legacy code from BTC times Resolves #12727 Auditors: Test Plan: --- app/browser/api/ledger.js | 19 +------------- test/unit/app/browser/api/ledgerTest.js | 34 ------------------------- 2 files changed, 1 insertion(+), 52 deletions(-) diff --git a/app/browser/api/ledger.js b/app/browser/api/ledger.js index f52377edfc7..7b384c027f0 100644 --- a/app/browser/api/ledger.js +++ b/app/browser/api/ledger.js @@ -1931,24 +1931,7 @@ const initialize = (state, paymentsEnabled) => { } const getContributionAmount = (state) => { - let amount = ledgerState.getContributionAmount(state) - - // if amount is 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 15: updatedAmount = 75; break - case 20: updatedAmount = 100; break - } - - if (updatedAmount) { - if (clientOptions.verboseP) { - console.log('\nmigrating contribution amount of ' + amount + ' from USD to BAT (new amount is ' + updatedAmount + ')') - } - appActions.changeSetting(settings.PAYMENTS_CONTRIBUTION_AMOUNT, updatedAmount) - return updatedAmount - } - return amount + return ledgerState.getContributionAmount(state) } const onInitRead = (state, parsedData) => { diff --git a/test/unit/app/browser/api/ledgerTest.js b/test/unit/app/browser/api/ledgerTest.js index 24bee780b4d..610076d705b 100644 --- a/test/unit/app/browser/api/ledgerTest.js +++ b/test/unit/app/browser/api/ledgerTest.js @@ -280,40 +280,6 @@ describe('ledger api unit tests', function () { ledgerApi.onInitRead(defaultAppState, parsedLedgerData) assert(setPaymentInfoSpy.withArgs(10).calledOnce) }) - - describe('when contribution amount is still set to the USD amount (before BAT Mercury)', function () { - after(function () { - contributionAmount = 10 - }) - describe('when set to 15 USD', function () { - before(function () { - setPaymentInfoSpy.reset() - onChangeSettingSpy.reset() - contributionAmount = 15 - ledgerApi.onInitRead(defaultAppState, parsedLedgerData) - }) - it('converts to 75 BAT', function () { - assert(setPaymentInfoSpy.withArgs(75).calledOnce) - }) - it('updates the setting', function () { - assert(onChangeSettingSpy.withArgs(settings.PAYMENTS_CONTRIBUTION_AMOUNT, 75).calledOnce) - }) - }) - describe('when set to 20 USD', function () { - before(function () { - setPaymentInfoSpy.reset() - onChangeSettingSpy.reset() - contributionAmount = 20 - ledgerApi.onInitRead(defaultAppState, parsedLedgerData) - }) - it('converts to 100 BAT', function () { - assert(setPaymentInfoSpy.withArgs(100).calledOnce) - }) - it('updates the setting', function () { - assert(onChangeSettingSpy.withArgs(settings.PAYMENTS_CONTRIBUTION_AMOUNT, 100).calledOnce) - }) - }) - }) }) describe('checkBtcBatMigrated', function () {