Skip to content

Commit

Permalink
chore: added tests around expect outcomes
Browse files Browse the repository at this point in the history
  • Loading branch information
petertonysmith94 committed Jan 28, 2025
1 parent 6601743 commit 0d8a4d5
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion packages/fuels/test/features/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('init', () => {
});
});

it('should run `init` command with --contracts', async () => {
it('should run `init` command with --contracts [absolute path]', async () => {
await runInit({
root: paths.root,
contracts: [paths.contractsBarDir, paths.contractsFooDir],
Expand All @@ -67,6 +67,46 @@ describe('init', () => {
});
});

it('should run `init` command with --contracts [glob path - multiple matches]', async () => {
await runInit({
root: paths.root,
contracts: [`${paths.contractsDir}/*`],
output: paths.outputDir,
});

const relativeContractPaths = [
paths.upgradableChunkedContractPath,
paths.upgradableContractPath,
paths.contractsBarDir,
paths.contractsFooDir,
].map((path) => path.replace(paths.workspaceDir, 'workspace'));

expect(existsSync(paths.fuelsConfigPath)).toBeTruthy();
const fuelsConfig = await loadFuelsConfig(paths.fuelsConfigPath);
expect(fuelsConfig).toEqual({
contracts: expect.arrayContaining(relativeContractPaths),
output: './output',
});
});

it('should run `init` command with --contracts [glob path - single path]', async () => {
await runInit({
root: paths.root,
contracts: [`${paths.contractsBarDir}/*`],
output: paths.outputDir,
});

const [relativeBarDir] = [paths.contractsBarDir.replace(paths.workspaceDir, 'workspace')];

expect(existsSync(paths.fuelsConfigPath)).toBeTruthy();

const fuelsConfig = await loadFuelsConfig(paths.fuelsConfigPath);
expect(fuelsConfig).toEqual({
contracts: [relativeBarDir],
output: './output',
});
});

it('should run `init` command with --predicates', async () => {
await runInit({
root: paths.root,
Expand Down

0 comments on commit 0d8a4d5

Please sign in to comment.