Skip to content

Commit

Permalink
Merge pull request #270 from cosmos/fabo/fix-console-error-catching
Browse files Browse the repository at this point in the history
Fabo/fix console error catching
  • Loading branch information
mappum authored Dec 27, 2017
2 parents 11f418b + d2f311a commit 0db8736
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 35 deletions.
2 changes: 1 addition & 1 deletion app/src/renderer/components/staking/LiDelegate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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' }}
Expand Down
4 changes: 0 additions & 4 deletions test/unit/helpers/console_error_throw.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
36 changes: 9 additions & 27 deletions test/unit/specs/LiDelegate.spec.js
Original file line number Diff line number Diff line change
@@ -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: {
Expand Down Expand Up @@ -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', () => {
Expand Down
7 changes: 4 additions & 3 deletions test/unit/specs/__snapshots__/LiDelegate.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ exports[`LiDelegate has the expected html structure 1`] = `
<i
class="fa fa-square-o"
/>
<router-link
to="[object Object]"
<a
class=""
href="#/staking/delegates/pubkeyX"
>
pubkeyX
</router-link>
</a>
</span>
</div>
<div
Expand Down

0 comments on commit 0db8736

Please sign in to comment.