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

Failed tests to be solved #1

Open
Njine opened this issue Aug 18, 2024 · 0 comments
Open

Failed tests to be solved #1

Njine opened this issue Aug 18, 2024 · 0 comments

Comments

@Njine
Copy link
Owner

Njine commented Aug 18, 2024

npx hardhat test

Ballot
when the contract is deployed
✔ has the provided proposals (13702ms)
✔ has zero votes for all proposals
✔ sets the deployer address as chairperson
✔ sets the voting weight for the chairperson as 1
when the chairperson interacts with the giveRightToVote function
1) gives right to vote for another address
2) cannot give right to vote for someone that has voted
3) cannot give right to vote for someone that already has voting rights
when the voter interacts with the vote function
4) should register the vote
when the voter interacts with the delegate function
5) should transfer voting power
when an account other than the chairperson interacts with giveRightToVote
6) should revert
when an account without right to vote interacts with the vote function
7) should revert
when someone interacts with the winningProposal function before any votes are cast
✔ should return 0
when someone interacts with the winnerName function before any votes are cast
✔ should return name of proposal 0

Lock
Deployment
✔ Should set the right unlockTime (207ms)
✔ Should set the right owner
✔ Should receive and store the funds to lock
✔ Should fail if the unlockTime is not in the future (903ms)
Withdrawals
Validations
✔ Should revert with the right error if called too soon
✔ Should revert with the right error if called from another account
✔ Shouldn't fail if the unlockTime has arrived and the owner calls it (123ms)
Events
✔ Should emit an event on withdrawals

14 passing (17s)
7 failing

  1. Ballot
    when the chairperson interacts with the giveRightToVote function
    gives right to vote for another address:
    AbiEncodingLengthMismatchError: ABI encoding params/values length mismatch.
    Expected length (params): 1
    Given length (values): 0

Version: 2.19.6
at encodeAbiParameters (node_modules/viem/utils/abi/encodeAbiParameters.ts:92:11)
at encodeFunctionData (node_modules/viem/utils/abi/encodeFunctionData.ts:93:28)
at writeContract (node_modules/viem/actions/wallet/writeContract.ts:161:34)
at writeContract (node_modules/viem/clients/decorators/wallet.ts:713:43)
at Proxy. (node_modules/viem/actions/getContract.ts:726:16)
at Context. (test/Ballot.ts:52:40)

  1. Ballot
    when the chairperson interacts with the giveRightToVote function
    cannot give right to vote for someone that has voted:
    AbiEncodingLengthMismatchError: ABI encoding params/values length mismatch.
    Expected length (params): 1
    Given length (values): 0

Version: 2.19.6
at encodeAbiParameters (node_modules/viem/utils/abi/encodeAbiParameters.ts:92:11)
at encodeFunctionData (node_modules/viem/utils/abi/encodeFunctionData.ts:93:28)
at writeContract (node_modules/viem/actions/wallet/writeContract.ts:161:34)
at writeContract (node_modules/viem/clients/decorators/wallet.ts:713:43)
at Proxy. (node_modules/viem/actions/getContract.ts:726:16)
at Context. (test/Ballot.ts:59:40)

  1. Ballot
    when the chairperson interacts with the giveRightToVote function
    cannot give right to vote for someone that already has voting rights:
    AbiEncodingLengthMismatchError: ABI encoding params/values length mismatch.
    Expected length (params): 1
    Given length (values): 0

Version: 2.19.6
at encodeAbiParameters (node_modules/viem/utils/abi/encodeAbiParameters.ts:92:11)
at encodeFunctionData (node_modules/viem/utils/abi/encodeFunctionData.ts:93:28)
at writeContract (node_modules/viem/actions/wallet/writeContract.ts:161:34)
at writeContract (node_modules/viem/clients/decorators/wallet.ts:713:43)
at Proxy. (node_modules/viem/actions/getContract.ts:726:16)
at Context. (test/Ballot.ts:66:40)

  1. Ballot
    when the voter interacts with the vote function
    should register the vote:
    AbiEncodingLengthMismatchError: ABI encoding params/values length mismatch.
    Expected length (params): 1
    Given length (values): 0

Version: 2.19.6
at encodeAbiParameters (node_modules/viem/utils/abi/encodeAbiParameters.ts:92:11)
at encodeFunctionData (node_modules/viem/utils/abi/encodeFunctionData.ts:93:28)
at writeContract (node_modules/viem/actions/wallet/writeContract.ts:161:34)
at writeContract (node_modules/viem/clients/decorators/wallet.ts:713:43)
at Proxy. (node_modules/viem/actions/getContract.ts:726:16)
at Context. (test/Ballot.ts:74:40)

  1. Ballot
    when the voter interacts with the delegate function
    should transfer voting power:
    AbiEncodingLengthMismatchError: ABI encoding params/values length mismatch.
    Expected length (params): 1
    Given length (values): 0

Version: 2.19.6
at encodeAbiParameters (node_modules/viem/utils/abi/encodeAbiParameters.ts:92:11)
at encodeFunctionData (node_modules/viem/utils/abi/encodeFunctionData.ts:93:28)
at writeContract (node_modules/viem/actions/wallet/writeContract.ts:161:34)
at writeContract (node_modules/viem/clients/decorators/wallet.ts:713:43)
at Proxy. (node_modules/viem/actions/getContract.ts:726:16)
at Context. (test/Ballot.ts:84:40)

  1. Ballot
    when an account other than the chairperson interacts with giveRightToVote
    should revert:
    TypeError: ballotContract.connect is not a function
    at Context. (test/Ballot.ts:94:41)

  2. Ballot
    when an account without right to vote interacts with the vote function
    should revert:
    TypeError: ballotContract.connect is not a function
    at Context. (test/Ballot.ts:101:41)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant