diff --git a/app/src/renderer/components/staking/LiDelegate.vue b/app/src/renderer/components/staking/LiDelegate.vue index f66ce3ec1d..f10e6a61fc 100644 --- a/app/src/renderer/components/staking/LiDelegate.vue +++ b/app/src/renderer/components/staking/LiDelegate.vue @@ -5,7 +5,7 @@ transition(name='ts-li-delegate'): .li-delegate(:class='styles'): .li-delegate__ span i.fa.fa-check-square-o(v-if='inCart' @click='rm(delegate)') i.fa.fa-square-o(v-else @click='add(delegate)') - router-link(v-if="config.devMode" :to="{ name: 'delegate', params: { delegate: delegate.id }}") {{ delegate.id }} + router-link(v-if="config.devMode && delegate.id" :to="{ name: 'delegate', params: { delegate: delegate.id }}") {{ delegate.id }} a(v-else) {{ delegate.id }} .li-delegate__value span {{ delegate.country ? delegate.country : 'n/a' }} diff --git a/test/unit/helpers/console_error_throw.js b/test/unit/helpers/console_error_throw.js index 73816b61db..f1a8ccdb10 100644 --- a/test/unit/helpers/console_error_throw.js +++ b/test/unit/helpers/console_error_throw.js @@ -1,7 +1,3 @@ -global.console.error = (...args) => { - throw Error('Console Error: ' + args.join(' ')) -} - if (!process.env.LISTENING_TO_UNHANDLED_REJECTION) { process.on('unhandledRejection', reason => { throw reason diff --git a/test/unit/specs/LiDelegate.spec.js b/test/unit/specs/LiDelegate.spec.js index 3a22ae96ae..4e3863ba8f 100644 --- a/test/unit/specs/LiDelegate.spec.js +++ b/test/unit/specs/LiDelegate.spec.js @@ -1,30 +1,18 @@ -import Vuex from 'vuex' -import { mount, createLocalVue } from 'vue-test-utils' +import setup from '../helpers/vuex-setup' import LiDelegate from 'renderer/components/staking/LiDelegate' -const shoppingCart = require('renderer/vuex/modules/shoppingCart').default({}) -const delegates = require('renderer/vuex/modules/delegates').default({}) - -const localVue = createLocalVue() -localVue.use(Vuex) - describe('LiDelegate', () => { let wrapper, store, delegate + let instance = setup() beforeEach(() => { - store = new Vuex.Store({ - getters: { - shoppingCart: () => shoppingCart.state.delegates, - delegates: () => delegates.state, - config: () => ({ - devMode: true - }) - }, - modules: { - shoppingCart, - delegates + let test = instance.mount(LiDelegate, { + propsData: { + delegate: {} } }) + wrapper = test.wrapper + store = test.store store.commit('addDelegate', { pub_key: { @@ -55,15 +43,9 @@ describe('LiDelegate', () => { delegate = store.state.delegates[0] - wrapper = mount(LiDelegate, { - localVue, - store, - propsData: { - delegate - } + wrapper.setData({ + delegate }) - - jest.spyOn(store, 'commit') }) it('has the expected html structure', () => { diff --git a/test/unit/specs/__snapshots__/LiDelegate.spec.js.snap b/test/unit/specs/__snapshots__/LiDelegate.spec.js.snap index 79e9229aab..3f3ad34a3f 100644 --- a/test/unit/specs/__snapshots__/LiDelegate.spec.js.snap +++ b/test/unit/specs/__snapshots__/LiDelegate.spec.js.snap @@ -18,11 +18,12 @@ exports[`LiDelegate has the expected html structure 1`] = ` - pubkeyX - +