@@ -115,21 +74,10 @@ export default {
unbonding_time: `Time to complete an undelegation transaction and claim rewards`,
max_validators: `Maximum number of validators in the validator set`,
bond_denom: `The token being used for staking`
- },
- poolTooltips: {
- description: `The staking pool represents the dynamic parameters of the Cosmos Hub`,
- loose_tokens: `Total tokens which are not currently delegated to a validator`,
- bonded_tokens: `Total tokens which are currently delegated to a validator`
}
}),
computed: {
- ...mapGetters([
- `config`,
- `stakingParameters`,
- `pool`,
- `connected`,
- `bondDenom`
- ]),
+ ...mapGetters([`config`, `stakingParameters`, `connected`, `bondDenom`]),
unbondingTimeInDays() {
return (
parseInt(this.stakingParameters.parameters.unbonding_time) /
@@ -139,7 +87,6 @@ export default {
},
async mounted() {
this.$store.dispatch(`getStakingParameters`)
- this.$store.dispatch(`getPool`)
}
}
diff --git a/app/src/renderer/routes.js b/app/src/renderer/routes.js
index 9751e0cfc9..41d22330c0 100644
--- a/app/src/renderer/routes.js
+++ b/app/src/renderer/routes.js
@@ -80,7 +80,11 @@ export default [
name: `transactions`,
component: require(`./components/wallet/PageTransactions`).default
},
-
+ {
+ path: `/network`,
+ name: `network`,
+ component: require(`./components/network/PageNetwork`).default
+ },
{ path: `/404`, component: require(`./components/common/Page404`).default },
{ path: `*`, component: require(`./components/common/Page404`).default }
]
diff --git a/app/src/renderer/vuex/modules/connection.js b/app/src/renderer/vuex/modules/connection.js
index d7acfc7192..aa24ee5431 100644
--- a/app/src/renderer/vuex/modules/connection.js
+++ b/app/src/renderer/vuex/modules/connection.js
@@ -16,7 +16,7 @@ export default function({ node }) {
},
approvalRequired: null,
mocked: node.mocked,
- nodeUrl: config.node_lcd,
+ nodeUrl: config.stargate,
externals: {
node,
config
@@ -96,7 +96,9 @@ export default function({ node }) {
})
node.rpc.subscribe(
- { query: `tm.event = 'NewBlockHeader'` },
+ {
+ query: `tm.event = 'NewBlockHeader'`
+ },
({ header }) => {
dispatch(`setLastHeader`, header)
}
diff --git a/test/unit/helpers/fixed_time.js b/test/unit/helpers/fixed_time.js
index f318ba4e1a..7250796e13 100644
--- a/test/unit/helpers/fixed_time.js
+++ b/test/unit/helpers/fixed_time.js
@@ -1,10 +1,5 @@
"use strict"
-/* globals jest */
-require(`moment`)
-const mockMomentTz = require(`moment-timezone`)
-jest.mock(`moment`, () => time => mockMomentTz(time).tz(`Etc/UTC`))
-
const DATE_TO_USE = new Date(Date.UTC(1970, 0, 1, 0, 0, 42))
global._Date = Date
global.Date = jest.fn(() => new global._Date(DATE_TO_USE.toISOString()))
diff --git a/test/unit/specs/components/network/PageNetwork.spec.js b/test/unit/specs/components/network/PageNetwork.spec.js
new file mode 100644
index 0000000000..160a18f5c8
--- /dev/null
+++ b/test/unit/specs/components/network/PageNetwork.spec.js
@@ -0,0 +1,78 @@
+import { shallowMount, createLocalVue } from "@vue/test-utils"
+import PageNetwork from "renderer/components/network/PageNetwork"
+
+const localVue = createLocalVue()
+localVue.directive(`tooltip`, () => {})
+
+describe(`PageNetwork`, () => {
+ let wrapper, $store
+
+ beforeEach(() => {
+ $store = {
+ getters: {
+ connected: true,
+ lastHeader: {
+ chain_id: `gaia-20k`,
+ proposer_address: `EFH47FH723HDHSH`,
+ height: `6001`,
+ total_txs: `108`,
+ time: Date.now()
+ },
+ delegates: {
+ delegates: [
+ {
+ a: `b`,
+ c: `d`
+ }
+ ]
+ },
+ config: {
+ devMode: true
+ },
+ pool: {
+ pool: {
+ bonded_tokens: 125,
+ loose_tokens: 10
+ }
+ },
+ bondDenom: `stake`
+ }
+ }
+
+ wrapper = shallowMount(PageNetwork, {
+ localVue,
+ mocks: {
+ $store
+ }
+ })
+ })
+
+ it(`has the expected html structure`, () => {
+ expect(wrapper.vm.$el).toMatchSnapshot()
+ })
+
+ it(`sets the status correctly`, () => {
+ expect(wrapper.vm.status).toEqual({
+ color: `green`,
+ message: `Network is up and running`
+ })
+
+ $store = {
+ getters: {
+ connected: false
+ }
+ }
+
+ wrapper = shallowMount(PageNetwork, {
+ localVue,
+ mocks: {
+ $store
+ }
+ })
+
+ expect(wrapper.vm.status).toEqual({
+ color: `red`,
+ message: `Network is down`
+ })
+ })
+})
diff --git a/test/unit/specs/components/network/__snapshots__/PageNetwork.spec.js.snap b/test/unit/specs/components/network/__snapshots__/PageNetwork.spec.js.snap
new file mode 100644
index 0000000000..c97acd7605
--- /dev/null
+++ b/test/unit/specs/components/network/__snapshots__/PageNetwork.spec.js.snap
@@ -0,0 +1,147 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`PageNetwork has the expected html structure 1`] = `
+
+
+
+
+
+
+
+
+
+`;
diff --git a/test/unit/specs/components/staking/TabParameters.spec.js b/test/unit/specs/components/staking/TabParameters.spec.js
index b6d7d8a020..462fc5e273 100644
--- a/test/unit/specs/components/staking/TabParameters.spec.js
+++ b/test/unit/specs/components/staking/TabParameters.spec.js
@@ -2,7 +2,7 @@ import setup from "../../../helpers/vuex-setup"
import TabParameters from "renderer/components/staking/TabParameters"
import lcdClientMock from "renderer/connectors/lcdClientMock.js"
-const { pool, stakingParameters } = lcdClientMock.state
+const { stakingParameters } = lcdClientMock.state
describe(`TabParameters`, () => {
let wrapper, store
@@ -18,21 +18,18 @@ describe(`TabParameters`, () => {
wrapper = instance.wrapper
store = instance.store
store.commit(`setConnected`, true)
- store.commit(`setPool`, pool)
store.commit(`setStakingParameters`, stakingParameters.parameters)
store.state.stakingParameters.loaded = true
- store.state.pool.loaded = true
})
it(`has the expected html structure`, async () => {
expect(wrapper.vm.$el).toMatchSnapshot()
})
- it(`shows the staking parameters and pool`, () => {
+ it(`shows the staking parameters`, () => {
expect(store.state.stakingParameters.parameters).toEqual(
stakingParameters.parameters
)
- expect(store.state.pool.pool).toEqual(pool)
})
it(`displays unbonding period in days`, () => {
@@ -47,25 +44,23 @@ describe(`TabParameters`, () => {
expect(wrapper.vm.$el).toMatchSnapshot()
store.state.stakingParameters.loaded = true
- store.state.pool.loaded = false
+
expect(wrapper.vm.$el).toMatchSnapshot()
- expect(wrapper.contains(`tm-data-connecting-stub`)).toBe(true)
+ expect(wrapper.contains(`tm-data-connecting-stub`)).toBe(false)
})
it(`displays a message if loading`, () => {
store.commit(`setConnected`, true)
store.state.stakingParameters.loaded = false
store.state.stakingParameters.loading = true
- store.state.pool.loaded = true
- store.state.pool.loading = true
+
expect(wrapper.vm.$el).toMatchSnapshot()
expect(wrapper.contains(`tm-data-loading-stub`)).toBe(true)
store.state.stakingParameters.loaded = true
store.state.stakingParameters.loading = false
- store.state.pool.loaded = false
- store.state.pool.loading = true
+
expect(wrapper.vm.$el).toMatchSnapshot()
- expect(wrapper.contains(`tm-data-loading-stub`)).toBe(true)
+ expect(wrapper.contains(`tm-data-loading-stub`)).toBe(false)
})
})
diff --git a/test/unit/specs/components/staking/__snapshots__/TabParameters.spec.js.snap b/test/unit/specs/components/staking/__snapshots__/TabParameters.spec.js.snap
index 42d4bf93da..289a9ca107 100644
--- a/test/unit/specs/components/staking/__snapshots__/TabParameters.spec.js.snap
+++ b/test/unit/specs/components/staking/__snapshots__/TabParameters.spec.js.snap
@@ -7,16 +7,6 @@ exports[`TabParameters displays a message if loading 1`] = `
`;
exports[`TabParameters displays a message if loading 2`] = `
-
-`;
-
-exports[`TabParameters displays a message if waiting for connection 1`] = `
`;
-
-exports[`TabParameters displays a message if waiting for connection 2`] = `
`;
-
-exports[`TabParameters has the expected html structure 1`] = `
- Total Liquid STAKE
+ Duration of Undelegation Period
- 100.0000000000
+ 3 days
+
+
+ -
+ Current Staking Token
+
+
+ -
+ STAKE
+
+
+ Maximum Number of Validators
+
+
+
- Total Delegated STAKE
+ 100
+
+
+
+
+
+
+