UNPKG

@cosmology/ast

Version:
27 lines 1.44 kB
import { getNestedProto } from '@cosmology/utils'; import { defaultTelescopeOptions } from '@cosmology/types'; import { expectCode, getTestProtoStore } from '../../../test-utils/'; import { AminoParseContext, ProtoParseContext } from '../context'; import { createObjectWithMethods } from '../object'; const store = getTestProtoStore(); store.traverseAll(); describe('Duraation: duration', () => { const ref = store.findProto('cosmos/gov/v1beta1/gov.proto'); const context = new ProtoParseContext(ref, store, defaultTelescopeOptions); const aminoCtx = new AminoParseContext(ref, store, defaultTelescopeOptions); context.options.prototypes.typingsFormat.duration = 'duration'; aminoCtx.options.prototypes.typingsFormat.duration = 'duration'; it('DepositParams', () => { expectCode(createObjectWithMethods(context, 'DepositParams', getNestedProto(ref.traversed).DepositParams)); }); }); describe('Duration: string', () => { const ref = store.findProto('cosmos/gov/v1beta1/gov.proto'); const context = new ProtoParseContext(ref, store, defaultTelescopeOptions); const aminoCtx = new AminoParseContext(ref, store, defaultTelescopeOptions); context.options.prototypes.typingsFormat.duration = 'string'; aminoCtx.options.prototypes.typingsFormat.duration = 'string'; it('DepositParams', () => { expectCode(createObjectWithMethods(context, 'DepositParams', getNestedProto(ref.traversed).DepositParams)); }); });