From 419f85a8277203bfd5114a3ffe698a222f0be945 Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Wed, 4 Dec 2024 18:29:12 +0000 Subject: [PATCH] Readd removed test --- .../__snapshots__/outputHelper.test.ts.snap | 14 ++++++++ tests/helpers/outputHelper.test.ts | 36 +++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/tests/helpers/__snapshots__/outputHelper.test.ts.snap b/tests/helpers/__snapshots__/outputHelper.test.ts.snap index a044c01..fa6efad 100644 --- a/tests/helpers/__snapshots__/outputHelper.test.ts.snap +++ b/tests/helpers/__snapshots__/outputHelper.test.ts.snap @@ -34,3 +34,17 @@ subreddit = rabbits sortBy = hot limit = 100" `; + +exports[`GenerateOutput GIVEN the Gallery input has more than 1 item, EXPECT Gallery line to be added 1`] = ` +"Archived = false +Author = author +Downs = 0 +Hidden = false +Permalink = /r/Rabbits/comments/1dj8pbt/this_is_my_ms_bear/ +Subreddit = Rabbits +SubredditSubscribers = 654751 +Title = This is my Ms Bear! +Ups = 17 +Url = https://preview.redd.it/d5yno653zf7d1.jpg?width=640&crop=smart&auto=webp&s=5064d1caec3c12ac2855eb57ff131d0b313d5e9d +Gallery = https://preview.redd.it/d5yno653zf7d1.jpg?width=640&crop=smart&auto=webp&s=5064d1caec3c12ac2855eb57ff131d0b313d5e9d,https://preview.redd.it/d5yno653zf7d1.jpg?width=640&crop=smart&auto=webp&s=5064d1caec3c12ac2855eb57ff131d0b313d5e9d" +`; diff --git a/tests/helpers/outputHelper.test.ts b/tests/helpers/outputHelper.test.ts index 049e813..a6acb44 100644 --- a/tests/helpers/outputHelper.test.ts +++ b/tests/helpers/outputHelper.test.ts @@ -140,4 +140,40 @@ describe("GenerateOutput", () => { // Assert expect(result).toMatchSnapshot(); }); + + test("GIVEN the Gallery input has more than 1 item, EXPECT Gallery line to be added", () => { + // Arrange + const response = { + IsSuccess: true, + Query: { + subreddit: "rabbits", + sortBy: "hot", + limit: 100, + }, + Result: { + Archived: false, + Author: 'author', + Downs: 0, + Hidden: false, + Permalink: "/r/Rabbits/comments/1dj8pbt/this_is_my_ms_bear/", + Subreddit: "Rabbits", + SubredditSubscribers: 654751, + Title: "This is my Ms Bear!", + Ups: 17, + Url: "https://preview.redd.it/d5yno653zf7d1.jpg?width=640&crop=smart&auto=webp&s=5064d1caec3c12ac2855eb57ff131d0b313d5e9d", + Gallery: [ + "https://preview.redd.it/d5yno653zf7d1.jpg?width=640&crop=smart&auto=webp&s=5064d1caec3c12ac2855eb57ff131d0b313d5e9d", + "https://preview.redd.it/d5yno653zf7d1.jpg?width=640&crop=smart&auto=webp&s=5064d1caec3c12ac2855eb57ff131d0b313d5e9d" + ], + }, + } as IReturnResult; + + const options = {} as ICliOptions; + + // Act + const result = OutputHelper.GenerateOutput(response, options); + + // Assert + expect(result).toMatchSnapshot(); + }); }); \ No newline at end of file