@cosmology/ast
Version:
Cosmos TypeScript AST generation
64 lines (54 loc) • 1.42 kB
text/typescript
import { getGenericParseContext, expectCode } from '../../../test-utils'
import {
addEncodedMethod,
addFromPartialMethod,
addJsonMethod,
addFromJSONMethod,
addToJSONMethod,
createHelperObject,
} from './helpers';
import { Mutation } from '../../types'
export const mutations: Mutation[] = [
{
methodName: 'joinPool',
typeUrl: '/cosmos.pools.transfer.v1.MsgJoinPool',
TypeName: 'MsgJoinPool'
},
{
methodName: 'exitPool',
typeUrl: '/cosmos.pools.transfer.v1.MsgExitPool',
TypeName: 'MsgExitPool'
}
];
it('addEncodedMethod', async () => {
expectCode(addEncodedMethod(mutations[0]));
});
it('addFromPartialMethod', async () => {
expectCode(addFromPartialMethod(mutations[0]));
});
it('addToJSONMethod', async () => {
expectCode(addToJSONMethod(mutations[0]));
});
it('addFromJSONMethod', async () => {
expectCode(addFromJSONMethod(mutations[0]));
});
it('addJsonMethod', async () => {
expectCode(addJsonMethod(mutations[0]));
});
it('createHelperObject', async () => {
const context = getGenericParseContext()
// @ts-ignore
context.ref = {
proto: {
package: 'a.b.c',
imports: [],
root: {},
importNames: {}
}
};
expectCode(createHelperObject({
context,
name: 'MessageComposer',
mutations
}));
});