From 349b05b34668c6c18d86cfcbeb540d8951c7c819 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Sat, 14 Sep 2019 18:25:17 +0300 Subject: [PATCH] Saving active tokens test wip --- src/logic/tokens/utils/tokensStorage.js | 11 ----------- src/test/tokens.dom.enabling.test.js | 5 ++++- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/logic/tokens/utils/tokensStorage.js b/src/logic/tokens/utils/tokensStorage.js index 7cd06968..0016ebbb 100644 --- a/src/logic/tokens/utils/tokensStorage.js +++ b/src/logic/tokens/utils/tokensStorage.js @@ -31,17 +31,6 @@ export const getCustomTokens = async (): Promise> => { return data ? List(data) : List() } -export const setToken = async (safeAddress: string, token: Token) => { - const data: List = await getCustomTokens() - - try { - await saveToStorage(CUSTOM_TOKENS_KEY, data.push(token)) - } catch (err) { - // eslint-disable-next-line - console.log('Error adding token in localstorage') - } -} - export const removeTokenFromStorage = async (safeAddress: string, token: Token) => { const data: List = await getCustomTokens() diff --git a/src/test/tokens.dom.enabling.test.js b/src/test/tokens.dom.enabling.test.js index 3284b707..ac2d7218 100644 --- a/src/test/tokens.dom.enabling.test.js +++ b/src/test/tokens.dom.enabling.test.js @@ -11,6 +11,7 @@ import { clickOnManageTokens, toggleToken, closeManageTokensModal } from './util import { BALANCE_ROW_TEST_ID } from '~/routes/safe/components/Balances' import { makeToken } from '~/logic/tokens/store/model/token' import '@testing-library/jest-dom/extend-expect' +import { getActiveTokens } from '~/logic/tokens/utils/tokensStorage' describe('DOM > Feature > Enable and disable default tokens', () => { let web3 @@ -43,7 +44,7 @@ describe('DOM > Feature > Enable and disable default tokens', () => { ]) }) - it('allows to enable and disable tokens', async () => { + it('allows to enable and disable tokens, stores active ones in the local storage', async () => { // GIVEN const store = aNewStore() const safeAddress = await aMinedSafe(store) @@ -79,5 +80,7 @@ describe('DOM > Feature > Enable and disable default tokens', () => { balanceRows = TokensDom.getAllByTestId(BALANCE_ROW_TEST_ID) expect(balanceRows.length).toBe(1) expect(balanceRows[0]).toHaveTextContent('ETH') + + expect() }) })