Fix bug where you weren't able to use both the -q and -j flags at the same time (#227)
- Fix bug where if you supplied both `-q`/`--query-metadata` and `-j`/`--json` the query metadata wasn't added to the output - Update tests #181 Reviewed-on: #227 Reviewed-by: VylpesTester <tester@vylpes.com> Co-authored-by: Ethan Lane <ethan@vylpes.com> Co-committed-by: Ethan Lane <ethan@vylpes.com>
This commit is contained in:
parent
3fe8a76534
commit
3b2da358b3
3 changed files with 70 additions and 39 deletions
|
@ -106,6 +106,41 @@ describe("GenerateOutput", () => {
|
|||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
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();
|
||||
});
|
||||
|
||||
test("GIVEN the Gallery input has more than 1 item, EXPECT Gallery line to be added", () => {
|
||||
// Arrange
|
||||
const response = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue