A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
ciphermask/ui/app/pages/settings/settings-tab/tests/settings-tab.test.js

61 lines
1.6 KiB

import assert from 'assert'
import React from 'react'
import sinon from 'sinon'
import { mount } from 'enzyme'
import SettingsTab from '../index'
describe('Settings Tab', function () {
let wrapper
const props = {
setCurrentCurrency: sinon.spy(),
displayWarning: sinon.spy(),
setUseBlockie: sinon.spy(),
updateCurrentLocale: sinon.spy(),
setUseNativeCurrencyAsPrimaryCurrencyPreference: sinon.spy(),
warning: '',
currentLocale: 'en',
useBlockie: false,
currentCurrency: 'usd',
conversionDate: 1,
nativeCurrency: 'eth',
useNativeCurrencyAsPrimaryCurrency: true,
}
beforeEach(function () {
wrapper = mount(
<SettingsTab.WrappedComponent {...props} />, {
context: {
t: (str) => str,
},
},
)
})
it('selects currency', async function () {
const selectCurrency = wrapper.find({ placeholder: 'selectCurrency' })
selectCurrency.props().onSelect('eur')
assert(props.setCurrentCurrency.calledOnce)
})
it('selects locale', async function () {
const selectLocale = wrapper.find({ placeholder: 'selectLocale' })
await selectLocale.props().onSelect('ja')
assert(props.updateCurrentLocale.calledOnce)
})
it('sets fiat primary currency', function () {
const selectFiat = wrapper.find('#fiat-primary-currency')
selectFiat.simulate('change')
assert(props.setUseNativeCurrencyAsPrimaryCurrencyPreference.calledOnce)
})
it('toggles blockies', function () {
const toggleBlockies = wrapper.find({ type: 'checkbox' })
toggleBlockies.simulate('click')
assert(props.setUseBlockie.calledOnce)
})
})