UNPKG

@cosmology/ast

Version:
132 lines (120 loc) 4.83 kB
import { getNestedProto } from '@cosmology/utils'; import { expectCode, getMiscTestProtoStore, getTestProtoStore } from '../../../../../test-utils/' import { ProtoParseContext } from '../../../context'; import { createAminoType } from '../amino'; import { createProtoInterfaceEncodedType } from '../proto'; const store = getTestProtoStore(); store.traverseAll(); const miscStore = getMiscTestProtoStore({ prototypes: { excluded: { // hard exclude faulty proto files hardProtos: ["google/api/expr/v1alpha1/eval1.proto"], }, }, }); miscStore.traverseAll(); describe('MsgSend', () => { const ref = store.findProto('cosmos/bank/v1beta1/tx.proto'); const context = new ProtoParseContext(ref, store, store.options); context.options.aminoEncoding.useLegacyInlineEncoding = true; it('amino interface', () => { expectCode(createAminoType(context, 'MsgSend', getNestedProto(ref.traversed).MsgSend )); }); }); describe('PageRequest', () => { const ref = store.findProto('cosmos/base/query/v1beta1/pagination.proto'); const context = new ProtoParseContext(ref, store, store.options); context.options.aminoEncoding.useLegacyInlineEncoding = true; it('interface', () => { expectCode(createAminoType(context, 'PageRequest', getNestedProto(ref.traversed).PageRequest )); }); }); describe('PageResponse', () => { const ref = store.findProto('cosmos/base/query/v1beta1/pagination.proto'); const context = new ProtoParseContext(ref, store, store.options); context.options.aminoEncoding.useLegacyInlineEncoding = true; it('interface', () => { expectCode(createAminoType(context, 'PageResponse', getNestedProto(ref.traversed).PageResponse )); }); }); describe('cosmos/auth/v1beta1/auth.proto', () => { const ref = store.findProto('cosmos/auth/v1beta1/auth.proto'); const context = new ProtoParseContext(ref, store, store.options); context.options.aminoEncoding.useLegacyInlineEncoding = true; it('BaseAccount', () => { expectCode(createAminoType(context, 'BaseAccount', getNestedProto(ref.traversed).BaseAccount )); }); }); describe('GenesisState', () => { const ref = store.findProto('cosmos/auth/v1beta1/genesis.proto'); const context = new ProtoParseContext(ref, store, store.options); context.options.aminoEncoding.useLegacyInlineEncoding = true; it('interface', () => { expectCode(createAminoType(context, 'GenesisState', getNestedProto(ref.traversed).GenesisState )); }); }); describe('cosmos/authz/v1beta1/authz.proto', () => { const ref = store.findProto('cosmos/authz/v1beta1/authz.proto'); const context = new ProtoParseContext(ref, store, store.options); context.options.aminoEncoding.useLegacyInlineEncoding = true; it('Grant', () => { expectCode(createAminoType(context, 'Grant', getNestedProto(ref.traversed).Grant )); }); it('GrantAuthorization', () => { expectCode(createAminoType(context, 'GrantAuthorization', getNestedProto(ref.traversed).GrantAuthorization )); }); }); describe('cosmos/authz/v1beta1/query.proto', () => { const ref = store.findProto('cosmos/authz/v1beta1/query.proto'); const context = new ProtoParseContext(ref, store, store.options); context.options.aminoEncoding.useLegacyInlineEncoding = true; it('QueryGrantsRequest', () => { expectCode(createAminoType(context, 'QueryGrantsRequest', getNestedProto(ref.traversed).QueryGrantsRequest )); }); }); describe('confio/proofs.proto', () => { const ref = store.findProto('confio/proofs.proto'); const context = new ProtoParseContext(ref, store, store.options); context.options.aminoEncoding.useLegacyInlineEncoding = true; it('ExistenceProof', () => { expectCode(createAminoType(context, 'ExistenceProof', getNestedProto(ref.traversed).ExistenceProof )); }); }); describe('osmosis/gamm/v1beta1/tx.proto', () => { const ref = store.findProto('osmosis/gamm/v1beta1/tx.proto'); const context = new ProtoParseContext(ref, store, store.options); context.options.aminoEncoding.useLegacyInlineEncoding = true; it('MsgJoinPool', () => { expectCode(createAminoType(context, 'MsgJoinPool', getNestedProto(ref.traversed).MsgJoinPool )); }); }); describe('misc/eval_request', () => { const ref = miscStore.findProto('misc/eval_request.proto'); const context = new ProtoParseContext(ref, miscStore, miscStore.options); it('EvalRequest', () => { expectCode(createAminoType(context, 'EvalRequest', getNestedProto(ref.traversed).EvalRequest )); }); });