mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-11 14:09:15 +00:00
Cleanup from PR review
This commit is contained in:
parent
3e48ee1213
commit
8699e2e8f7
@ -350,7 +350,7 @@ describe("RestClient", () => {
|
|||||||
const contractBalance = (await client.authAccounts(contractAddress)).result.value.coins;
|
const contractBalance = (await client.authAccounts(contractAddress)).result.value.coins;
|
||||||
expect(contractBalance).toEqual([]);
|
expect(contractBalance).toEqual([]);
|
||||||
}
|
}
|
||||||
}, 10_000);
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("query", () => {
|
describe("query", () => {
|
||||||
@ -446,7 +446,7 @@ describe("RestClient", () => {
|
|||||||
client
|
client
|
||||||
.getContractInfo(beneficiaryAddress)
|
.getContractInfo(beneficiaryAddress)
|
||||||
.then(() => fail("this shouldn't succeed"))
|
.then(() => fail("this shouldn't succeed"))
|
||||||
.catch(() => {});
|
.catch(error => expect(error).toMatch(`No contract with address ${beneficiaryAddress}`));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("contract state", () => {
|
describe("contract state", () => {
|
||||||
@ -462,8 +462,6 @@ describe("RestClient", () => {
|
|||||||
return contractInfos[0];
|
return contractInfos[0];
|
||||||
};
|
};
|
||||||
|
|
||||||
let dataByState: unknown;
|
|
||||||
|
|
||||||
it("can get all state", async () => {
|
it("can get all state", async () => {
|
||||||
pendingWithoutCosmos();
|
pendingWithoutCosmos();
|
||||||
const contractAddress = await getContractAddress();
|
const contractAddress = await getContractAddress();
|
||||||
@ -473,7 +471,8 @@ describe("RestClient", () => {
|
|||||||
expect(state.length).toEqual(1);
|
expect(state.length).toEqual(1);
|
||||||
const data = state[0];
|
const data = state[0];
|
||||||
expect(data.key.toLowerCase()).toEqual(toHex(expectedKey));
|
expect(data.key.toLowerCase()).toEqual(toHex(expectedKey));
|
||||||
dataByState = data.val;
|
expect((data.val as any).verifier).toBeDefined();
|
||||||
|
expect((data.val as any).beneficiary).toBeDefined();
|
||||||
|
|
||||||
// bad address is empty array
|
// bad address is empty array
|
||||||
const noContractState = await client.getAllContractState(noContract);
|
const noContractState = await client.getAllContractState(noContract);
|
||||||
@ -487,7 +486,8 @@ describe("RestClient", () => {
|
|||||||
// query by one key
|
// query by one key
|
||||||
const model = await client.queryContractRaw(contractAddress, expectedKey);
|
const model = await client.queryContractRaw(contractAddress, expectedKey);
|
||||||
expect(model).not.toBeNull();
|
expect(model).not.toBeNull();
|
||||||
expect(model).toEqual(dataByState);
|
expect((model as any).verifier).toBeDefined();
|
||||||
|
expect((model as any).beneficiary).toBeDefined();
|
||||||
|
|
||||||
// missing key is null
|
// missing key is null
|
||||||
const missing = await client.queryContractRaw(contractAddress, fromHex("cafe0dad"));
|
const missing = await client.queryContractRaw(contractAddress, fromHex("cafe0dad"));
|
||||||
@ -507,16 +507,22 @@ describe("RestClient", () => {
|
|||||||
expect(verifier).toEqual(faucetAddress);
|
expect(verifier).toEqual(faucetAddress);
|
||||||
|
|
||||||
// invalid query syntax throws an error
|
// invalid query syntax throws an error
|
||||||
client
|
await client
|
||||||
.queryContractSmart(contractAddress, { no_such_key: {} })
|
.queryContractSmart(contractAddress, { nosuchkey: {} })
|
||||||
.then(() => fail("shouldn't succeed"))
|
.then(() => fail("shouldn't succeed"))
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
|
// TODO: debug rest server. Here I get:
|
||||||
|
// Expected Error: Request failed with status code 500 to match 'Parse Error:'
|
||||||
|
// .catch(error => expect(error).toMatch(`not found: contract`));
|
||||||
|
|
||||||
// invalid address throws an error
|
// invalid address throws an error
|
||||||
client
|
await client
|
||||||
.queryContractSmart(noContract, { verifier: {} })
|
.queryContractSmart(noContract, { verifier: {} })
|
||||||
.then(() => fail("shouldn't succeed"))
|
.then(() => fail("shouldn't succeed"))
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
|
// TODO: debug rest server. Here I get:
|
||||||
|
// Expected Error: Request failed with status code 500 to match 'Parse Error:'
|
||||||
|
// .catch(error => expect(error).toMatch(`not found: contract`));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user