Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
Zetazzz committed Mar 6, 2023
1 parent f6ffe03 commit 7482490
Show file tree
Hide file tree
Showing 2 changed files with 339 additions and 352 deletions.
344 changes: 174 additions & 170 deletions packages/ts-codegen/__tests__/builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,189 +5,193 @@ const FIXTURE_DIR = __dirname + '/../../../__fixtures__';
const OUTPUT_DIR = __dirname + '/../../../__output__/builder';

it('options undefined', async () => {
const outPath = OUTPUT_DIR + '/vectis/factory-opt';
const schemaDir = FIXTURE_DIR + '/vectis/factory/';
const builder = new TSBuilder({
contracts: [schemaDir],
outPath,
options: undefined
});
delete builder.contracts;
delete builder.outPath;
expect(builder).toMatchSnapshot();
const outPath = OUTPUT_DIR + '/vectis/factory-opt';
const schemaDir = FIXTURE_DIR + '/vectis/factory/';
const builder = new TSBuilder({
contracts: [
schemaDir
],
outPath,
options: undefined
});
delete builder.contracts;
delete builder.outPath;
expect(builder).toMatchSnapshot();
});

it('options tsClient.enabled', async () => {
const outPath = OUTPUT_DIR + '/vectis/factory-opt';
const schemaDir = FIXTURE_DIR + '/vectis/factory/';
const builder = new TSBuilder({
contracts: [schemaDir],
outPath,
options: {
types: {
enabled: true
},
client: {
enabled: true
},
reactQuery: {
enabled: true
}
}
});
delete builder.contracts;
delete builder.outPath;
expect(builder).toMatchSnapshot();
const outPath = OUTPUT_DIR + '/vectis/factory-opt';
const schemaDir = FIXTURE_DIR + '/vectis/factory/';
const builder = new TSBuilder({
contracts: [
schemaDir
],
outPath,
options: {
types: {
enabled: true
},
client: {
enabled: true
},
reactQuery: {
enabled: true
}
}
});
delete builder.contracts;
delete builder.outPath;
expect(builder).toMatchSnapshot();
});

it('builder invoke', async () => {
const outPath = OUTPUT_DIR + '/invoke/';
const s = (str) => FIXTURE_DIR + str;
const builder = new TSBuilder({
contracts: [
s('/vectis/factory'),
s('/minter'),
s('/daodao/cw-admin-factory'),
s('/daodao/cw-code-id-registry'),
{
name: 'CwSingle',
dir: s('/daodao/cw-proposal-single')
}
],
outPath,
options: {
types: {
enabled: true
},
client: {
enabled: true
},
reactQuery: {
enabled: true
}
}
});
await builder.build();
const outPath = OUTPUT_DIR + '/invoke/';
const s = (str) => FIXTURE_DIR + str;
const builder = new TSBuilder({
contracts: [
s('/vectis/factory'),
s('/minter'),
s('/daodao/cw-admin-factory'),
s('/daodao/cw-code-id-registry'),
{
name: 'CwSingle',
dir: s('/daodao/cw-proposal-single')
}
],
outPath,
options: {
types: {
enabled: true
},
client: {
enabled: true
},
reactQuery: {
enabled: true
}
}
});
await builder.build();
});

it('builder default', async () => {
const outPath = OUTPUT_DIR + '/default/';
const s = (str) => FIXTURE_DIR + str;
await codegen({
contracts: [
s('/vectis/factory'),
s('/minter'),
s('/daodao/cw-admin-factory'),
s('/daodao/cw-code-id-registry'),
{
name: 'CwSingle',
dir: s('/daodao/cw-proposal-single')
}
],
outPath,
options: {
bundle: {
bundleFile: 'index.ts',
scope: 'smart.contracts'
},
types: {
enabled: true
},
client: {
enabled: true,
execExtendsQuery: true
},
reactQuery: {
enabled: true
},
recoil: {
enabled: true
},
messageComposer: {
enabled: true
}
}
});
const outPath = OUTPUT_DIR + '/default/';
const s = (str) => FIXTURE_DIR + str;
await codegen({
contracts: [
s('/vectis/factory'),
s('/minter'),
s('/daodao/cw-admin-factory'),
s('/daodao/cw-code-id-registry'),
{
name: 'CwSingle',
dir: s('/daodao/cw-proposal-single')
}
],
outPath,
options: {
bundle: {
bundleFile: 'index.ts',
scope: 'smart.contracts'
},
types: {
enabled: true
},
client: {
enabled: true,
execExtendsQuery: true
},
reactQuery: {
enabled: true
},
recoil: {
enabled: true
},
messageComposer: {
enabled: true
}
}
});
});

it('builder no extends', async () => {
const outPath = OUTPUT_DIR + '/no-extends/';
const s = (str) => FIXTURE_DIR + str;
await codegen({
contracts: [
s('/vectis/factory'),
s('/minter'),
s('/daodao/cw-admin-factory'),
s('/daodao/cw-code-id-registry'),
{
name: 'CwSingle',
dir: s('/daodao/cw-proposal-single')
}
],
outPath,
options: {
bundle: {
bundleFile: 'index.ts',
scope: 'smart.contracts'
},
types: {
enabled: true
},
client: {
enabled: true,
execExtendsQuery: false
},
reactQuery: {
enabled: true
},
recoil: {
enabled: true
},
messageComposer: {
enabled: true
}
}
});
const outPath = OUTPUT_DIR + '/no-extends/';
const s = (str) => FIXTURE_DIR + str;
await codegen({
contracts: [
s('/vectis/factory'),
s('/minter'),
s('/daodao/cw-admin-factory'),
s('/daodao/cw-code-id-registry'),
{
name: 'CwSingle',
dir: s('/daodao/cw-proposal-single')
}
],
outPath,
options: {
bundle: {
bundleFile: 'index.ts',
scope: 'smart.contracts'
},
types: {
enabled: true
},
client: {
enabled: true,
execExtendsQuery: false
},
reactQuery: {
enabled: true
},
recoil: {
enabled: true
},
messageComposer: {
enabled: true
}
}
});
});

it('builder set bundler path', async () => {
const outPath = OUTPUT_DIR + '/bundler_test/contracts';
const bundlerPath = OUTPUT_DIR + '/bundler_test/';
const s = (str) => FIXTURE_DIR + str;
await codegen({
contracts: [
s('/vectis/factory'),
s('/minter'),
s('/daodao/cw-admin-factory'),
s('/daodao/cw-code-id-registry'),
{
name: 'CwSingle',
dir: s('/daodao/cw-proposal-single')
}
],
outPath,
options: {
bundle: {
bundlePath: bundlerPath,
bundleFile: 'index.ts',
scope: 'smart.contracts'
},
types: {
enabled: true
},
client: {
enabled: true,
execExtendsQuery: false
},
reactQuery: {
enabled: true
},
recoil: {
enabled: true
},
messageComposer: {
enabled: true
}
}
});
const outPath = OUTPUT_DIR + '/bundler_test/contracts';
const bundlerPath = OUTPUT_DIR + '/bundler_test/';
const s = (str) => FIXTURE_DIR + str;
await codegen({
contracts: [
s('/vectis/factory'),
s('/minter'),
s('/daodao/cw-admin-factory'),
s('/daodao/cw-code-id-registry'),
{
name: 'CwSingle',
dir: s('/daodao/cw-proposal-single')
}
],
outPath,
options: {
bundle: {
bundlePath: bundlerPath,
bundleFile: 'index.ts',
scope: 'smart.contracts'
},
types: {
enabled: true
},
client: {
enabled: true,
execExtendsQuery: false
},
reactQuery: {
enabled: true
},
recoil: {
enabled: true
},
messageComposer: {
enabled: true
}
}
});
});
Loading

0 comments on commit 7482490

Please sign in to comment.