diff --git a/src/cli.ts b/src/cli.ts index 4989718..0de5ab3 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -9,8 +9,7 @@ program .name('random-bunny') .description('Get a random image url from a subreddit of your choosing') .version('2.2') - .option('-s, --subreddit ', 'The subreddit to search', 'rabbits') - .option('-j, --json', 'Output as JSON'); + .option('-s, --subreddit ', 'The subreddit to search', 'rabbits'); program.parse(); @@ -22,12 +21,6 @@ randomBunny(options.subreddit) const result = response.Result!; const outputLines: string[] = []; - - if (options.json) { - console.log(JSON.stringify(result)); - return; - } - outputLines.push(`Archived = ${result.Archived}`); outputLines.push(`Downvotes = ${result.Downs}`); outputLines.push(`Hidden = ${result.Hidden}`); diff --git a/src/contracts/ICliOptions.ts b/src/contracts/ICliOptions.ts index 5aab9da..c85971d 100644 --- a/src/contracts/ICliOptions.ts +++ b/src/contracts/ICliOptions.ts @@ -1,4 +1,3 @@ export default interface ICliOptions { subreddit: string, - json?: boolean, } \ No newline at end of file diff --git a/tests/cli.test.ts b/tests/cli.test.ts index 79d30b6..6d105d3 100644 --- a/tests/cli.test.ts +++ b/tests/cli.test.ts @@ -88,25 +88,7 @@ describe('subreddit', () => { expect(subreddit).toBe('Horses'); }, 5000); -}); - -describe('json', () => { - test('GIVEN -j is supplied, EXPECT output to be valid JSON', async () => { - const result = await cli(['-j'], '.'); - - const json = JSON.parse(result.stdout); - - expect(json).toBeDefined(); - }, 5000); - - test('GIVEN --json is supplied, EXPECT output to be valid JSON', async () => { - const result = await cli(['--json'], '.'); - - const json = JSON.parse(result.stdout); - - expect(json).toBeDefined(); - }, 5000); -}); +}) function cli(args: string[], cwd: string): Promise { return new Promise(resolve => {