Skip to content

Commit

Permalink
fix governance.ctrl.defid.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
canonbrother committed Jul 3, 2024
1 parent 79d93a2 commit 2b55479
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,11 @@ describe('governance - listProposals and getProposal', () => {
})
})

describe('governance - listProposalVotes', () => {
describe.only('governance - listProposalVotes', () => {
beforeAll(async () => {
app = new DefidBin()
await app.start([
`-masternode_operator=${RegTestFoundationKeys[1].operator.address}`,
`-masternode_operator=${RegTestFoundationKeys[2].operator.address}`,
`-masternode_operator=${RegTestFoundationKeys[3].operator.address}`
])
Expand All @@ -263,6 +264,8 @@ describe('governance - listProposalVotes', () => {
await testing.client.wallet.importPrivKey(RegTestFoundationKeys[1].operator.privKey)
await testing.client.wallet.importPrivKey(RegTestFoundationKeys[2].owner.privKey)
await testing.client.wallet.importPrivKey(RegTestFoundationKeys[2].operator.privKey)
await testing.client.wallet.importPrivKey(RegTestFoundationKeys[3].owner.privKey)
await testing.client.wallet.importPrivKey(RegTestFoundationKeys[3].operator.privKey)

// Create 1 CFP + 1 VOC
payoutAddress = await testing.generateAddress()
Expand Down Expand Up @@ -297,10 +300,13 @@ describe('governance - listProposalVotes', () => {

// Vote on cycle 2
const masternodes = await testing.client.masternode.listMasternodes()
console.log('masternodes: ', masternodes)
const votes = [VoteDecision.YES, VoteDecision.NO, VoteDecision.NEUTRAL]
let index = 0
for (const [id, data] of Object.entries(masternodes)) {
console.log('data: ', data)
if (data.operatorIsMine) {
console.log('votes[index]: ', votes[index])
await app.generate(1, data.operatorAuthAddress) // Generate a block to operatorAuthAddress to be allowed to vote on proposal
await testing.client.governance.voteGov({
proposalId: cfpProposalId,
Expand All @@ -317,8 +323,9 @@ describe('governance - listProposalVotes', () => {
await app.stop()
})

it('should listProposalVotes', async () => {
it.only('should listProposalVotes', async () => {
const result = await controller.listProposalVotes(cfpProposalId)
console.log('result: ', result)
const yesVote = result.data.find(vote => vote.vote === ProposalVoteResultType.YES)
const noVote = result.data.find(vote => vote.vote === ProposalVoteResultType.NO)
const neutralVote = result.data.find(vote => vote.vote === ProposalVoteResultType.NEUTRAL)
Expand Down

0 comments on commit 2b55479

Please sign in to comment.