This commit is contained in:
parent
5d0af43b6f
commit
f7667fe3b7
2 changed files with 6 additions and 3 deletions
|
@ -147,7 +147,7 @@ describe('query-metadata', () => {
|
|||
expect(query).toBeUndefined();
|
||||
}, 5000);
|
||||
|
||||
test('GIVEN --query-metadata is not supplied, EXPECT no query metadata returned', async () => {
|
||||
test('GIVEN --query-metadata is supplied, EXPECT query metadata returned', async () => {
|
||||
const result = await cli(['--query-metadata'], '.');
|
||||
|
||||
const query = result.stdout.split('\n')
|
||||
|
@ -156,7 +156,7 @@ describe('query-metadata', () => {
|
|||
expect(query).toBeDefined();
|
||||
}, 5000);
|
||||
|
||||
test('GIVEN -q is not supplied, EXPECT no query metadata returned', async () => {
|
||||
test('GIVEN -q is supplied, EXPECT query metadata returned', async () => {
|
||||
const result = await cli(['-q'], '.');
|
||||
|
||||
const query = result.stdout.split('\n')
|
||||
|
|
|
@ -226,7 +226,7 @@ describe('randomBunny', () => {
|
|||
expect(fetchMock).toBeCalledWith('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://i.redd.it/gallery/cr8xudsnkgua1");
|
||||
});
|
||||
|
||||
test("GIVEN data fetched is a gallery AND an image is not returned from the helper, EXPECT error", async () => {
|
||||
|
@ -259,5 +259,8 @@ describe('randomBunny', () => {
|
|||
expect(ImageHelper.FetchImageFromRedditGallery).toHaveBeenCalledTimes(1);
|
||||
|
||||
expect(result.IsSuccess).toBe(false);
|
||||
expect(result.Error).toBeDefined();
|
||||
expect(result.Error?.Code).toBe(ErrorCode.NoImageResultsFound);
|
||||
expect(result.Error?.Message).toBe(ErrorMessages.NoImageResultsFound);
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue