Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Options
-l --logout nothing Accepts boolean value: use it in order to expire your current session.
-r --listPlans nothing Accepts boolean value: list all the plans that are offered in your account using it.
-u --serverUrl string Change the base URL for the FaaS.
-c --confDir string (TODO) Overwrite the default configuration directory.`;
-c --confDir string Overwrite the default configuration directory.`;

export const printHelp = (): void => {
console.log(helpText);
Expand Down
33 changes: 30 additions & 3 deletions src/test/cli.integration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { fail, notStrictEqual, ok, strictEqual } from 'assert';
import { writeFile } from 'fs/promises';
import { join } from 'path';
import { load } from '../config';
import {
Expand Down Expand Up @@ -74,6 +75,34 @@ describe('Integration CLI (Deploy)', function () {
}
});

// --confDir
it('Should be able to login using --confDir flag', async function () {
const file = await load();
const token = file.token || '';

notStrictEqual(token, '');

await clearCache();

const confDir = await createTmpDirectory();
const configPath = join(confDir, 'config.ini');
await writeFile(configPath, `token=${token}`, 'utf8');

const workdir = await createTmpDirectory();

try {
await runCLI(
[`--confDir=${confDir}`, `--workdir=${workdir}`],
[keys.enter, keys.enter]
).promise;
} catch (err) {
strictEqual(
err,
`X The directory you specified (${workdir}) is empty.\n`
);
}
});

// --help
it('Should be able to print help guide using --help flag', async () => {
const result = await runCLI(['--help'], [keys.enter]).promise;
Expand All @@ -92,9 +121,7 @@ describe('Integration CLI (Deploy)', function () {
)}`
);
} catch (err) {
ok(
String(err) === '! --yeet does not exist as a valid command.\n'
);
ok(String(err) === '! --yeet does not exist as a valid command.\n');
}
});

Expand Down