Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fabo/fix console error catching #270

Merged
merged 4 commits into from
Dec 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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