Skip to content

Commit

Permalink
Testing multilple paths in fuel init command
Browse files Browse the repository at this point in the history
  • Loading branch information
arboleya committed Dec 31, 2024
1 parent 9056e4c commit f310e23
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions packages/fuels/test/features/init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,55 @@ describe('init', () => {
expect(fuelsContents).not.toMatch(`fuelCorePath: 'fuels-core',`);
});

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

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

expect(existsSync(paths.fuelsConfigPath)).toBeTruthy();
const fuelsContents = readFileSync(paths.fuelsConfigPath, 'utf-8');
expect(fuelsContents).toMatch(/contracts:/);
expect(fuelsContents).toMatch(relativeBarDir);
expect(fuelsContents).toMatch(relativeFooDir);
});

it('should run `init` command with --predicate', async () => {
await runInit({
root: paths.root,
predicates: paths.predicateDir,
output: paths.outputDir,
});

const relativePredicateDir = paths.predicateDir.replace(paths.workspaceDir, 'workspace');

expect(existsSync(paths.fuelsConfigPath)).toBeTruthy();
const fuelsContents = readFileSync(paths.fuelsConfigPath, 'utf-8');
expect(fuelsContents).toMatch(/predicates:/);
expect(fuelsContents).toMatch(relativePredicateDir);
});

it('should run `init` command with --scripts', async () => {
await runInit({
root: paths.root,
scripts: paths.scriptsDir,
output: paths.outputDir,
});

const relativeScriptDir = paths.scriptsDir.replace(paths.workspaceDir, 'workspace');

expect(existsSync(paths.fuelsConfigPath)).toBeTruthy();
const fuelsContents = readFileSync(paths.fuelsConfigPath, 'utf-8');
expect(fuelsContents).toMatch(/scripts:/);
expect(fuelsContents).toMatch(relativeScriptDir);
});

it('should run `init` command using custom binaries', async () => {
await runInit({
root: paths.root,
Expand Down

0 comments on commit f310e23

Please sign in to comment.