add more tests for newly exposed grant queries

This commit is contained in:
Mantas Vidutis 2022-11-24 11:17:43 -08:00
parent 9263f33b69
commit 36fc113849
No known key found for this signature in database
GPG Key ID: 60BDC8CD8FA60E29

View File

@ -95,7 +95,51 @@ describe("AuthzExtension", () => {
// Decode the message
const msgDecoded = GenericAuthorization.decode(grant.authorization.value).msg;
// Check if its the same one then we granted
// Check if it's the same one then we granted
expect(msgDecoded).toEqual(grantedMsg);
tmClient.disconnect();
});
it("works querying by granter", async () => {
pendingWithoutSimapp44Or46();
const [client, tmClient] = await makeClientWithAuthz(simapp.tendermintUrl);
const response = await client.authz.granterGrants(granter1Address, "");
expect(response.grants.length).toEqual(1);
const grant = response.grants[0];
// Needs to respond with a grant
assertDefined(grant.authorization);
// Needs to be GenericAuthorization to decode it below
expect(grant.authorization.typeUrl).toEqual("/cosmos.authz.v1beta1.GenericAuthorization");
// Decode the message
const msgDecoded = GenericAuthorization.decode(grant.authorization.value).msg;
// Check if it's the same one then we granted
expect(msgDecoded).toEqual(grantedMsg);
tmClient.disconnect();
});
it("works querying by grantee", async () => {
pendingWithoutSimapp44Or46();
const [client, tmClient] = await makeClientWithAuthz(simapp.tendermintUrl);
const response = await client.authz.granteeGrants(grantee1Address, "");
expect(response.grants.length).toEqual(1);
const grant = response.grants[0];
// Needs to respond with a grant
assertDefined(grant.authorization);
// Needs to be GenericAuthorization to decode it below
expect(grant.authorization.typeUrl).toEqual("/cosmos.authz.v1beta1.GenericAuthorization");
// Decode the message
const msgDecoded = GenericAuthorization.decode(grant.authorization.value).msg;
// Check if it's the same one then we granted
expect(msgDecoded).toEqual(grantedMsg);
tmClient.disconnect();