From b2722b487ea8c7cecc682616a3d7601eb37351e9 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Thu, 7 Dec 2023 18:18:46 +0000 Subject: [PATCH] Update tests --- tests/cli.test.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/cli.test.ts b/tests/cli.test.ts index 6d105d3..79d30b6 100644 --- a/tests/cli.test.ts +++ b/tests/cli.test.ts @@ -88,7 +88,25 @@ 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 => {