Skip to content

Commit

Permalink
Merge branch 'develop' into fabo/438-post-micro-release
Browse files Browse the repository at this point in the history
  • Loading branch information
faboweb authored Feb 4, 2018
2 parents 7e5894a + 226da07 commit 70b9d1e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 18 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@ jobs:

- run: yarn lint
- run: yarn run test
post:
- bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN
- run: bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN
4 changes: 2 additions & 2 deletions app/src/renderer/components/staking/PageDelegate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export default {
let value = {
description: {}
}
if (this.delegates && this.$route.params.delegate) {
value = this.delegates.find(v => v.id === this.$route.params.delegate) || value
if (this.delegates.delegates && this.$route.params.delegate) {
value = this.delegates.delegates.find(v => v.id === this.$route.params.delegate) || value
}
return value
},
Expand Down
2 changes: 1 addition & 1 deletion codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ coverage:
default: off

comment:
layout: "header, reach, diff, flags, files, footer"
layout: "diff, files"
behavior: default
require_changes: no
require_base: no
Expand Down
6 changes: 3 additions & 3 deletions test/unit/specs/components/staking/LiDelegate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('LiDelegate', () => {
}
})

delegate = store.state.delegates[0]
delegate = store.state.delegates.delegates[0]

wrapper.setData({ delegate })
})
Expand Down Expand Up @@ -73,12 +73,12 @@ describe('LiDelegate', () => {
expect(wrapper.html()).not.toContain('li-delegate-active')
wrapper.find('#add-to-cart').trigger('click')
expect(wrapper.vm.inCart).toBeTruthy()
expect(store.commit).toHaveBeenCalledWith('addToCart', store.state.delegates[0])
expect(store.commit).toHaveBeenCalledWith('addToCart', store.state.delegates.delegates[0])
expect(wrapper.html()).toContain('li-delegate-active')
})

it('should remove from cart', () => {
store.commit('addToCart', store.state.delegates[0])
store.commit('addToCart', store.state.delegates.delegates[0])
wrapper.update()
expect(wrapper.vm.inCart).toBeTruthy()
wrapper.find('#remove-from-cart').trigger('click')
Expand Down
9 changes: 6 additions & 3 deletions test/unit/specs/components/staking/PageDelegates.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,19 @@ describe('PageDelegates', () => {
})

it('should show the amount of selected delegates', () => {
store.commit('addToCart', store.state.delegates[0])
store.commit('addToCart', store.state.delegates[1])
store.commit('addToCart', store.state.delegates.delegates[0])
store.commit('addToCart', store.state.delegates.delegates[1])
wrapper.update()
expect(wrapper.find('.fixed-button-bar strong').text().trim()).toContain('2')
})

it('should show placeholder if delegates are loading', () => {
let {wrapper} = mount(PageDelegates, {
getters: {
delegates: () => []
delegates: () => ({
delegates: [],
loading: true
})
},
stubs: {
'data-loading': '<data-loading />'
Expand Down
14 changes: 7 additions & 7 deletions test/unit/specs/store/delegates.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@ describe('Module: Delegates', () => {

it('adds delegate to state', () => {
store.commit('addDelegate', { pub_key: { data: 'foo' } })
expect(store.state.delegates[0]).toEqual({
expect(store.state.delegates.delegates[0]).toEqual({
id: 'foo',
pub_key: { data: 'foo' }
})
expect(store.state.delegates.length).toBe(1)
expect(store.state.delegates.delegates.length).toBe(1)
})

it('replaces existing delegate with same id', () => {
store.commit('addDelegate', { pub_key: { data: 'foo' }, updated: true })
expect(store.state.delegates[0]).toEqual({
expect(store.state.delegates.delegates[0]).toEqual({
id: 'foo',
pub_key: { data: 'foo' },
updated: true
})
expect(store.state.delegates.length).toBe(1)
expect(store.state.delegates.delegates.length).toBe(1)
})

it('fetches a candidate', async () => {
Expand All @@ -45,7 +45,7 @@ describe('Module: Delegates', () => {

await store.dispatch('getDelegate', { data: 'foo' })
expect(axios.get.mock.calls[0][0]).toBe('http://localhost:9060/query/stake/candidate/foo')
expect(store.state.delegates[0].test).toBe(123)
expect(store.state.delegates.delegates[0].test).toBe(123)
})

it('fetches all candidates', async () => {
Expand Down Expand Up @@ -78,7 +78,7 @@ describe('Module: Delegates', () => {
await store.dispatch('getDelegates')
expect(axios.get.mock.calls[0][0]).toBe('http://localhost:9060/query/stake/candidate/foo')
expect(axios.get.mock.calls[1][0]).toBe('http://localhost:9060/query/stake/candidate/bar')
expect(store.state.delegates[0].test).toBe(123)
expect(store.state.delegates[1].test).toBe(456)
expect(store.state.delegates.delegates[0].test).toBe(123)
expect(store.state.delegates.delegates[1].test).toBe(456)
})
})
2 changes: 2 additions & 0 deletions test/unit/specs/store/wallet.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ describe('Module: Wallet', () => {
it('should have an empty state by default', () => {
const state = {
balances: [],
balancesLoading: false,
key: { address: '' },
history: [],
historyLoading: false,
denoms: [],
blockMetas: []
}
Expand Down

0 comments on commit 70b9d1e

Please sign in to comment.