Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Tests for grpc errors in collection, token modules #87

Merged
merged 8 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Git LFS file not shown
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to
- [\#77](https://github.com/line/lbmjs/pull/77) @lbmjs/finschia: Enable amino sign store msgs in `wasm` and `wasmplus`
- [\#80](https://github.com/line/lbmjs/pull/80) add MsgInstantiateContract2
- [\#81](https://github.com/line/lbmjs/pull/81) add git PR template
- [\#87](https://github.com/line/finschia-js/pull/87) @lbmjs/finschia: add tests for grpc errors in collection, token

### Changed
- [\#84](https://github.com/line/finschia-js/pull/84) Bumpup cosmjs to 0.30.1
Expand Down
2 changes: 1 addition & 1 deletion packages/finschia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@cosmjs/tendermint-rpc": "^0.30.1",
"@cosmjs/utils": "^0.30.1",
"cosmjs-types": "^0.7.1",
"lbmjs-types": "^1.0.0-rc2",
"lbmjs-types": "^1.0.0-rc5",
"long": "^4.0.0",
"pako": "^2.0.2",
"protobufjs": "~6.10.2",
Expand Down
18 changes: 18 additions & 0 deletions packages/finschia/src/modules/collection/queries.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,24 @@ describe("CollectionExtension (non-fungible token)", () => {

tmClient.disconnect();
});
it("hasParent", async () => {
pendingWithoutSimapp();
assert(contractId, "Missing contract ID");
assert(tokenType, "Mission token type");
assert(tokenId1, "Mission token Id");
assert(tokenId3, "Mission token Id3");
const [client, tmClient] = await makeClientWithCollection(simapp.tendermintUrl);

try {
await client.collection.hasParent(contractId, tokenId1);
// eslint-disable-next-line no-empty
} catch (err) {}

const hasParent = await client.collection.hasParent(contractId, tokenId3);
expect(hasParent).toBeTrue();

tmClient.disconnect();
});
it("parent", async () => {
pendingWithoutSimapp();
assert(contractId, "Missing contract ID");
Expand Down
6 changes: 6 additions & 0 deletions packages/finschia/src/modules/collection/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface CollectionExtension {
readonly tokenType: (contractId: string, tokenType: string) => Promise<TokenType>;
readonly token: (contractId: string, tokenId: string) => Promise<Any>;
readonly root: (contractId: string, tokenId: string) => Promise<NFT>;
readonly hasParent: (contractId: string, tokenId: string) => Promise<boolean>;
readonly parent: (contractId: string, tokenId: string) => Promise<NFT>;
readonly children: (contractId: string, tokenId: string) => Promise<NFT[]>;
readonly granteeGrants: (contractId: string, grantee: string) => Promise<Grant[]>; // Since 0.46.0
Expand Down Expand Up @@ -110,6 +111,11 @@ export function setupCollectionExtension(base: QueryClient): CollectionExtension
assert(root);
return root;
},
hasParent: async (contractId: string, tokenId: string) => {
const { hasParent } = await queryService.HasParent({ contractId: contractId, tokenId: tokenId });
assert(hasParent);
loin3 marked this conversation as resolved.
Show resolved Hide resolved
return hasParent;
},
parent: async (contractId: string, tokenId: string) => {
const { parent } = await queryService.Parent({ contractId: contractId, tokenId: tokenId });
assert(parent);
Expand Down
Loading