Skip to content

Commit

Permalink
fix: update signatures and types
Browse files Browse the repository at this point in the history
  • Loading branch information
ratik committed Jan 19, 2023
1 parent 1b53147 commit 52a383b
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 27 deletions.
14 changes: 7 additions & 7 deletions src/testcases/governance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('Neutron / Governance', () => {
cm.wallet.address.toString(),
);
await getWithAttempts(
cm,
cm.blockWaiter,
async () =>
await cm.queryVotingPower(
CORE_CONTRACT_ADDRESS,
Expand All @@ -64,7 +64,7 @@ describe('Neutron / Governance', () => {
cm2.wallet.address.toString(),
);
await getWithAttempts(
cm2,
cm2.blockWaiter,
async () =>
await cm2.queryVotingPower(
CORE_CONTRACT_ADDRESS,
Expand All @@ -81,7 +81,7 @@ describe('Neutron / Governance', () => {
cm3.wallet.address.toString(),
);
await getWithAttempts(
cm3,
cm3.blockWaiter,
async () =>
await cm3.queryVotingPower(
CORE_CONTRACT_ADDRESS,
Expand All @@ -93,7 +93,7 @@ describe('Neutron / Governance', () => {
});
test('check voting power', async () => {
await getWithAttempts(
cm,
cm.blockWaiter,
async () => await cm.queryTotalVotingPower(CORE_CONTRACT_ADDRESS),
async (response) => response.power == 3000,
20,
Expand All @@ -105,7 +105,7 @@ describe('Neutron / Governance', () => {
test('send funds from wallet 1', async () => {
await cm.msgSend(CORE_CONTRACT_ADDRESS, '1000');
await getWithAttempts(
cm,
cm.blockWaiter,
async () => await cm.queryBalances(CORE_CONTRACT_ADDRESS),
async (response) => response.balances[0].amount == '1000',
20,
Expand Down Expand Up @@ -294,7 +294,7 @@ describe('Neutron / Governance', () => {
}
expect(rawLog.includes("proposal is not in 'passed' state"));
await getWithAttempts(
cm,
cm.blockWaiter,
async () =>
await cm.queryProposal(PROPOSE_CONTRACT_ADDRESS, proposalId),
async (response) => response.proposal.status === 'rejected',
Expand Down Expand Up @@ -404,7 +404,7 @@ describe('Neutron / Governance', () => {
}
expect(rawLog.includes("proposal is not in 'passed' state"));
await getWithAttempts(
cm,
cm.blockWaiter,
async () =>
await cm.queryMultiChoiceProposal(
PROPOSE_MULTIPLE_CONTRACT_ADDRESS,
Expand Down
6 changes: 3 additions & 3 deletions src/testcases/interchain_kv_query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ const acceptInterchainqueriesParamsChangeProposal = async (
);

await getWithAttempts(
cm,
cm.blockWaiter,
async () => await cm.queryProposal(PROPOSE_CONTRACT_ADDRESS, proposalId),
async (response) => response.proposal.status === 'executed',
20,
Expand Down Expand Up @@ -780,7 +780,7 @@ describe('Neutron / Interchain KV Query', () => {
);

await getWithAttempts(
cm[1],
cm[1].blockWaiter,
() => getRegisteredQuery(cm[1], contractAddress, queryId),
async (response) =>
response.registered_query.last_submitted_result_local_height > 0 &&
Expand All @@ -796,7 +796,7 @@ describe('Neutron / Interchain KV Query', () => {
await removeQueryViaTx(cm[1], queryId);

await getWithAttempts(
cm[1],
cm[1].blockWaiter,
async () =>
await cm[1].queryBalances(
testState.wallets.neutron.demo1.address.toString(),
Expand Down
8 changes: 4 additions & 4 deletions src/testcases/interchaintx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ describe('Neutron / Interchain TXs', () => {
);
expect(res.code).toEqual(0);
await getWithAttempts(
cm1,
cm1.blockWaiter,
async () => cm1.listIBCChannels(),
// Wait until there are 4 channels:
// - one exists already, it is open for IBC transfers;
Expand All @@ -439,7 +439,7 @@ describe('Neutron / Interchain TXs', () => {
async (channels) => channels.channels.length == 4,
);
await getWithAttempts(
cm1,
cm1.blockWaiter,
() => cm1.listIBCChannels(),
async (channels) =>
channels.channels.find((c) => c.channel_id == 'channel-3')?.state ==
Expand Down Expand Up @@ -530,7 +530,7 @@ describe('Neutron / Interchain TXs', () => {
);

const failuresAfterCall = await getWithAttempts<AckFailuresResponse>(
cm1,
cm1.blockWaiter,
async () => cm1.queryAckFailures(contractAddress),
// Wait until there 2 failure in the list
async (data) => data.failures.length == 2,
Expand Down Expand Up @@ -582,7 +582,7 @@ const waitForAck = (
numAttempts = 20,
) =>
getWithAttempts(
cm,
cm.blockWaiter,
() =>
cm.queryContract<AcknowledgementResult>(contractAddress, {
acknowledgement_result: {
Expand Down
18 changes: 14 additions & 4 deletions src/testcases/simple.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Long from 'long';
import {
AckFailuresResponse,
COSMOS_DENOM,
Expand Down Expand Up @@ -85,7 +86,10 @@ describe('Neutron / Simple', () => {
'channel-0',
{ denom: NEUTRON_DENOM, amount: '1000' },
testState.wallets.cosmos.demo2.address.toString(),
{ revision_number: 2, revision_height: 100000000 },
{
revision_number: new Long(2),
revision_height: new Long(100000000),
},
);
expect(res.code).toEqual(0);
});
Expand All @@ -108,7 +112,10 @@ describe('Neutron / Simple', () => {
'channel-0',
{ denom: COSMOS_DENOM, amount: '1000' },
testState.wallets.neutron.demo1.address.toString(),
{ revision_number: 2, revision_height: 100000000 },
{
revision_number: new Long(2),
revision_height: new Long(100000000),
},
);
expect(res.code).toEqual(0);
});
Expand Down Expand Up @@ -239,7 +246,10 @@ describe('Neutron / Simple', () => {
channelName,
{ denom: cm2.denom, amount: uatomAmount },
contractAddress,
{ revision_number: 2, revision_height: 100000000 },
{
revision_number: new Long(2),
revision_height: new Long(100000000),
},
);
expect(res.code).toEqual(0);

Expand Down Expand Up @@ -379,7 +389,7 @@ describe('Neutron / Simple', () => {
expect(attempts).toBeGreaterThan(0);

const failuresAfterCall = await getWithAttempts<AckFailuresResponse>(
cm,
cm.blockWaiter,
async () => cm.queryAckFailures(contractAddress),
// Wait until there 4 failure in the list
async (data) => data.failures.length == 4,
Expand Down
8 changes: 4 additions & 4 deletions src/testcases/subdao.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ describe('Neutron / Subdao', () => {

await cm.bondFunds(VAULT_CONTRACT_ADDRESS, '10000');
await getWithAttempts(
cm,
cm.blockWaiter,
async () =>
await cm.queryVotingPower(
subDAO.core.address,
main_dao_addr.toString(),
),
async (response) => response.power == '10000',
async (response) => response.power == 10000,
20,
);
await cm.msgSend(subDAO.core.address, '10000'); // funding for gas
Expand Down Expand Up @@ -373,8 +373,8 @@ describe('Neutron / Subdao', () => {
const afterExecBalance = await cm.queryBalances(
security_dao_addr.toString(),
);
expect(+afterExecBalance.balances[0].amount).toEqual(
+beforeExecBalance.balances[0].amount + funding,
expect(+(afterExecBalance.balances[0].amount || 0)).toEqual(
+(beforeExecBalance.balances[0].amount || 0) + funding,
);
});

Expand Down
11 changes: 6 additions & 5 deletions src/testcases/tokenomics.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ describe('Neutron / Tokenomics', () => {
test('Total burned neutrons amount has increased', async () => {
const burnedAfter = await cmNeutron.queryTotalBurnedNeutronsAmount();
const diff =
+burnedAfter.total_burned_neutrons_amount.coin.amount -
+burnedBefore.total_burned_neutrons_amount.coin.amount;
+(burnedAfter.total_burned_neutrons_amount.coin.amount || 0) -
+(burnedBefore.total_burned_neutrons_amount.coin.amount || 0);
expect(diff).toBeGreaterThanOrEqual(10e8 * 0.75);
});
});
Expand Down Expand Up @@ -86,7 +86,8 @@ describe('Neutron / Tokenomics', () => {
NEUTRON_DENOM,
);
const diff =
+totalSupplyBefore.amount.amount - +totalSupplyAfter.amount.amount;
+(totalSupplyBefore.amount.amount || 0) -
+(totalSupplyAfter.amount.amount || 0);
expect(diff).toBeGreaterThanOrEqual(10e8 * 0.75);
});
});
Expand Down Expand Up @@ -146,10 +147,10 @@ describe('Neutron / Tokenomics', () => {
amount: '100000',
},
testState.wallets.neutron.demo1.address.toString(),
{ revision_number: 2, revision_height: 100000000 },
{ revision_number: new Long(2), revision_height: new Long(100000000) },
);
await getWithAttempts(
cmNeutron,
cmNeutron.blockWaiter,
async () =>
cmNeutron.queryBalances(
testState.wallets.neutron.demo1.address.toString(),
Expand Down

0 comments on commit 52a383b

Please sign in to comment.