Fix gallery not finding any images if there is more than one image #259
2 changed files with 2 additions and 2 deletions
|
@ -96,7 +96,7 @@ export default async function randomBunny(subreddit: string, sortBy: "new" | "ho
|
|||
let gallery: string[];
|
||||
|
||||
if (randomData.url.includes("/gallery")) {
|
||||
const galleryImage = await ImageHelper.FetchImageFromRedditGallery(randomData.url);
|
||||
const galleryImage = await ImageHelper.FetchImageFromRedditGallery(`https://reddit.com${randomData.permalink}`);
|
||||
|
||||
if (!galleryImage) {
|
||||
return {
|
||||
|
|
|
@ -202,7 +202,7 @@ describe('randomBunny', () => {
|
|||
expect(fetchMock).toHaveBeenCalledWith('https://reddit.com/r/rabbits/new.json?limit=100');
|
||||
|
||||
expect(ImageHelper.FetchImageFromRedditGallery).toHaveBeenCalledTimes(1);
|
||||
expect(ImageHelper.FetchImageFromRedditGallery).toHaveBeenCalledWith("https://i.redd.it/gallery/cr8xudsnkgua1");
|
||||
expect(ImageHelper.FetchImageFromRedditGallery).toHaveBeenCalledWith("https://reddit.com/r/Rabbits/comments/12pa5te/someone_told_pickles_its_monday_internal_fury/");
|
||||
});
|
||||
|
||||
test("GIVEN data fetched is a gallery AND an image is not returned from the helper, EXPECT error", async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue