Update tests
All checks were successful
Test / build (push) Successful in 9s

This commit is contained in:
Ethan Lane 2024-09-15 11:55:14 +01:00
parent ebf270f2bb
commit bf026dae32
2 changed files with 36 additions and 1 deletions

View file

@ -15,6 +15,8 @@ Url = https://preview.redd.it/d5yno653zf7d1.jpg?width=640&crop=smart&auto=webp&s
exports[`GenerateOutput GIVEN options.json is true, EXPECT output to be returned as JSON 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"}"`; exports[`GenerateOutput GIVEN options.json is true, EXPECT output to be returned as JSON 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"}"`;
exports[`GenerateOutput GIVEN options.queryMetadata AND options.json is supplied, EXPECT query metadata to be in JSON format 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","query":{"subreddit":"rabbits","sortBy":"hot","limit":100}}"`;
exports[`GenerateOutput GIVEN options.queryMetadata is supplied, EXPECT query metadata to be added 1`] = ` exports[`GenerateOutput GIVEN options.queryMetadata is supplied, EXPECT query metadata to be added 1`] = `
"Archived = false "Archived = false
Author = author Author = author

View file

@ -103,5 +103,38 @@ describe("GenerateOutput", () => {
expect(result).toMatchSnapshot(); expect(result).toMatchSnapshot();
}); });
test.todo("GIVEN options.queryMetadata AND options.json is supplied, EXPECT query metadata to be in JSON format") test("GIVEN options.queryMetadata AND options.json is supplied, EXPECT query metadata to be in JSON format", () => {
// 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",
},
} as IReturnResult;
const options = {
json: true,
queryMetadata: true,
} as ICliOptions;
// Act
const result = OutputHelper.GenerateOutput(response, options);
// Assert
expect(result).toMatchSnapshot();
});
}); });