Saving active tokens test wip

This commit is contained in:
Mikhail Mikheev 2019-09-14 18:25:17 +03:00
parent de5013140d
commit 349b05b346
2 changed files with 4 additions and 12 deletions

View File

@ -31,17 +31,6 @@ export const getCustomTokens = async (): Promise<List<TokenProps>> => {
return data ? List(data) : List() return data ? List(data) : List()
} }
export const setToken = async (safeAddress: string, token: Token) => {
const data: List<TokenProps> = 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) => { export const removeTokenFromStorage = async (safeAddress: string, token: Token) => {
const data: List<TokenProps> = await getCustomTokens() const data: List<TokenProps> = await getCustomTokens()

View File

@ -11,6 +11,7 @@ import { clickOnManageTokens, toggleToken, closeManageTokensModal } from './util
import { BALANCE_ROW_TEST_ID } from '~/routes/safe/components/Balances' import { BALANCE_ROW_TEST_ID } from '~/routes/safe/components/Balances'
import { makeToken } from '~/logic/tokens/store/model/token' import { makeToken } from '~/logic/tokens/store/model/token'
import '@testing-library/jest-dom/extend-expect' import '@testing-library/jest-dom/extend-expect'
import { getActiveTokens } from '~/logic/tokens/utils/tokensStorage'
describe('DOM > Feature > Enable and disable default tokens', () => { describe('DOM > Feature > Enable and disable default tokens', () => {
let web3 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 // GIVEN
const store = aNewStore() const store = aNewStore()
const safeAddress = await aMinedSafe(store) const safeAddress = await aMinedSafe(store)
@ -79,5 +80,7 @@ describe('DOM > Feature > Enable and disable default tokens', () => {
balanceRows = TokensDom.getAllByTestId(BALANCE_ROW_TEST_ID) balanceRows = TokensDom.getAllByTestId(BALANCE_ROW_TEST_ID)
expect(balanceRows.length).toBe(1) expect(balanceRows.length).toBe(1)
expect(balanceRows[0]).toHaveTextContent('ETH') expect(balanceRows[0]).toHaveTextContent('ETH')
expect()
}) })
}) })