@cosmology/ast
Version:
Cosmos TypeScript AST generation
43 lines • 1.22 kB
JavaScript
import { getGenericParseContext, expectCode } from '../../../test-utils';
import { addEncodedMethod, addFromPartialMethod, addJsonMethod, addFromJSONMethod, addToJSONMethod, createHelperObject } from './helpers';
export const mutations = [{
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
}));
});