-
Notifications
You must be signed in to change notification settings - Fork 98
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
Parsed Err msg #1094
Parsed Err msg #1094
Changes from 13 commits
d27e390
0e61429
10a1dd4
b58cdaf
2d8b312
47cdc5e
9e89aae
d4d5f85
e909293
4579e00
05eb6f7
59a544f
89443d6
c8fe3c4
0decfd9
c04c7ef
e179dc0
0c5ba98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,15 +2,14 @@ import setup from "../../../helpers/vuex-setup" | |
import htmlBeautify from "html-beautify" | ||
import Vuelidate from "vuelidate" | ||
import PageBond from "renderer/components/staking/PageBond" | ||
|
||
describe("PageBond", () => { | ||
let wrapper, store, router | ||
let { mount, localVue } = setup() | ||
localVue.use(Vuelidate) | ||
|
||
beforeEach(() => { | ||
beforeEach(async () => { | ||
let test = mount(PageBond, { | ||
doBefore: ({ store }) => { | ||
doBefore: async ({ store, node }) => { | ||
store.commit("setAtoms", 101) | ||
|
||
store.commit("addToCart", { | ||
|
@@ -37,6 +36,20 @@ describe("PageBond", () => { | |
country: "Canada", | ||
moniker: "someOtherValidator" | ||
}) | ||
|
||
let candidates = await node.candidates() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. candidates are directly exported from |
||
store.commit( | ||
"addToCart", | ||
Object.assign( | ||
{ | ||
id: "pubkeyZ", | ||
voting_power: 20000, | ||
shares: 75000, | ||
moniker: "aChileanValidator" | ||
}, | ||
candidates[2] // this is the revoked one | ||
) | ||
) | ||
} | ||
}) | ||
store = test.store | ||
|
@@ -426,4 +439,27 @@ describe("PageBond", () => { | |
expect(wrapper.vm.showsRevokedValidators).toBe(true) | ||
expect(wrapper.vm.$el).toMatchSnapshot() | ||
}) | ||
|
||
it("shows an error if trying to bond to revoked candidates", async () => { | ||
await store.dispatch("signIn", { | ||
account: "default", | ||
password: "1234567890" | ||
}) | ||
|
||
wrapper.update() | ||
wrapper.vm.fields.bondConfirm = true | ||
wrapper.vm.fields.delegates[2].revoked = true | ||
wrapper.vm.fields.delegates[2].atoms = 1 | ||
wrapper.findAll("#btn-bond").trigger("click") | ||
await sleep(1000) | ||
let lastErr = | ||
store.state.notifications[store.state.notifications.length - 1] | ||
expect(lastErr.body).toContain( | ||
"Validator for this address is currently revoked" | ||
) | ||
}) | ||
}) | ||
|
||
function sleep(ms) { | ||
return new Promise(resolve => setTimeout(resolve, ms)) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -270,7 +270,7 @@ describe("LCD Client Mock", () => { | |
it("executes a delegate tx", async () => { | ||
let stake = await client.queryDelegation( | ||
lcdClientMock.addresses[0], | ||
lcdClientMock.validators[2] | ||
lcdClientMock.validators[1] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why was this changed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. because the validators[2] is the one with status revoked, so all the other tests get the revoked error before anything else happens |
||
) | ||
expect(stake).toBeUndefined() | ||
|
||
|
@@ -280,7 +280,7 @@ describe("LCD Client Mock", () => { | |
delegations: [ | ||
{ | ||
delegator_addr: lcdClientMock.addresses[0], | ||
validator_addr: lcdClientMock.validators[2], | ||
validator_addr: lcdClientMock.validators[1], | ||
delegation: { denom: "mycoin", amount: "10" } | ||
} | ||
], | ||
|
@@ -292,7 +292,7 @@ describe("LCD Client Mock", () => { | |
|
||
let updatedStake = await client.queryDelegation( | ||
lcdClientMock.addresses[0], | ||
lcdClientMock.validators[2] | ||
lcdClientMock.validators[1] | ||
) | ||
expect(updatedStake.shares).toBe("10") | ||
}) | ||
|
@@ -304,7 +304,7 @@ describe("LCD Client Mock", () => { | |
delegations: [ | ||
{ | ||
delegator_addr: lcdClientMock.addresses[0], | ||
validator_addr: lcdClientMock.validators[2], | ||
validator_addr: lcdClientMock.validators[1], | ||
delegation: { denom: "mycoin", amount: "10" } | ||
} | ||
], | ||
|
@@ -316,7 +316,7 @@ describe("LCD Client Mock", () => { | |
|
||
let initialStake = await client.queryDelegation( | ||
lcdClientMock.addresses[0], | ||
lcdClientMock.validators[2] | ||
lcdClientMock.validators[1] | ||
) | ||
expect(initialStake.shares).toBe("10") | ||
|
||
|
@@ -327,7 +327,7 @@ describe("LCD Client Mock", () => { | |
begin_unbondings: [ | ||
{ | ||
delegator_addr: lcdClientMock.addresses[0], | ||
validator_addr: lcdClientMock.validators[2], | ||
validator_addr: lcdClientMock.validators[1], | ||
shares: "5" | ||
} | ||
] | ||
|
@@ -338,7 +338,7 @@ describe("LCD Client Mock", () => { | |
|
||
let updatedStake = await client.queryDelegation( | ||
lcdClientMock.addresses[0], | ||
lcdClientMock.validators[2] | ||
lcdClientMock.validators[1] | ||
) | ||
expect(updatedStake.shares).toBe("5") | ||
}) | ||
|
@@ -368,7 +368,7 @@ describe("LCD Client Mock", () => { | |
delegations: [ | ||
{ | ||
delegator_addr: lcdClientMock.addresses[0], | ||
validator_addr: lcdClientMock.validators[2], | ||
validator_addr: lcdClientMock.validators[1], | ||
delegation: { denom: "mycoin", amount: "10" } | ||
} | ||
], | ||
|
@@ -384,7 +384,7 @@ describe("LCD Client Mock", () => { | |
delegations: [ | ||
{ | ||
delegator_addr: lcdClientMock.addresses[0], | ||
validator_addr: lcdClientMock.validators[2], | ||
validator_addr: lcdClientMock.validators[1], | ||
delegation: { denom: "mycoin", amount: "10" } | ||
} | ||
], | ||
|
@@ -425,7 +425,7 @@ describe("LCD Client Mock", () => { | |
delegations: [ | ||
{ | ||
delegator_addr: lcdClientMock.addresses[0], | ||
validator_addr: lcdClientMock.validators[2], | ||
validator_addr: lcdClientMock.validators[1], | ||
delegation: { denom: "mycoin", amount: "10" } | ||
}, | ||
{ | ||
|
@@ -444,7 +444,7 @@ describe("LCD Client Mock", () => { | |
|
||
let stake1 = await client.queryDelegation( | ||
lcdClientMock.addresses[0], | ||
lcdClientMock.validators[2] | ||
lcdClientMock.validators[1] | ||
) | ||
expect(stake1.shares).toMatchSnapshot() | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will probably be used more often (like with sending coins). Can we implement this somehow in
send.js
like changing the error message there?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to figure out which types of errors are encountered while transferring tokens