mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-10 21:49:15 +00:00
add more tests for newly exposed grant queries
This commit is contained in:
parent
9263f33b69
commit
36fc113849
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user