Skip to content

Commit

Permalink
add extra test for regex
Browse files Browse the repository at this point in the history
  • Loading branch information
bz888 committed Oct 10, 2023
1 parent 0932239 commit eefdc81
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions packages/cli/src/controller/init-controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,21 @@ describe('Cli can create project (mocked)', () => {
const manifest = (await fs.promises.readFile(path.join(__dirname, '../../test/schemaTest/project.ts'))).toString();
const v = findReplace(manifest, ENDPOINT_REG, "endpoint: 'wss://acala-polkadot.api.onfinality.io/public-ws'");

console.log(v);
// expect(extractFromTs(v, {
// endpoint: ENDPOINT_REG
// })).toStrictEqual(
// {endpoint: ["wss://acala-polkadot.api.onfinality.io/public-ws"]}
// )
expect(
extractFromTs(v, {
endpoint: ENDPOINT_REG,
})
).toStrictEqual({endpoint: ['wss://acala-polkadot.api.onfinality.io/public-ws']});
});
it('able to extract string endpoints', () => {
expect(
extractFromTs(
`
endpoint: 'wss://aaa'
`,
{endpoint: ENDPOINT_REG}
)
).toStrictEqual({endpoint: ['wss://aaa']});
});
it('Ensure prepareManifest and preparePackage correctness for project.ts', async () => {
const project = {
Expand Down

0 comments on commit eefdc81

Please sign in to comment.