Skip to content

Commit

Permalink
chore: Add more tests to config.current-project
Browse files Browse the repository at this point in the history
  • Loading branch information
angelmadames committed Feb 15, 2024
1 parent 6e4ade7 commit 086c9d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/utils/file-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ import fs from 'node:fs';
import { confirm } from '@inquirer/prompts';
import log from './log';

export const sleep = (seconds: number): Promise<void> => {
const time = seconds * 1000;
return new Promise((r) => setTimeout(r, time));
};

export const isFile = (path: string): boolean => {
return fs.existsSync(path) && fs.lstatSync(path).isFile();
};
Expand Down
13 changes: 13 additions & 0 deletions test/commands/config.current-project.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@ import fs from 'node:fs';
import { createFile, createPath } from '../../src/utils/file-system';

describe("Command: 'config current-project'", () => {
test('ensure --set option has no default value', () => {
const command = currentProjectCommand();
const optionValue = 'project';

const emptyOptionValue = command.getOptionValue('set');
const setOptionValue = command
.setOptionValue('set', optionValue)
.getOptionValue('set');

expect(emptyOptionValue).toBeUndefined();
expect(setOptionValue).toEqual(setOptionValue);
});

test('is set by --set flag', () => {
const current = 'testProject';
const currentProjectFile = './current-project-test';
Expand Down

0 comments on commit 086c9d9

Please sign in to comment.