diff --git a/packages/stargate/src/modules/authz/queries.spec.ts b/packages/stargate/src/modules/authz/queries.spec.ts index db516ef193..7da036d1a8 100644 --- a/packages/stargate/src/modules/authz/queries.spec.ts +++ b/packages/stargate/src/modules/authz/queries.spec.ts @@ -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();