Skip to content

Commit

Permalink
Chore: Improvements in tests query handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
mapeveri committed Jan 16, 2024
1 parent a9b2444 commit eaca44f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@ describe('FindCountryQueryHandler', () => {

const expected = await findCountryQueryHandler.execute(query);

expect(expected.content).toEqual(country.toPrimitives());
expect(expected.content).toEqual({
id: country.id.toString(),
name: country.name,
iso: country.iso,
languages: country.languages.toArray(),
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,20 @@ describe('FindCountryQueryHandler', () => {

const expected = await findCountriesQueryHandler.execute(query);

expect(expected.content).toEqual([countryOne.toPrimitives(), countryTwo.toPrimitives()]);
expect(expected.content).toEqual([
{
id: countryOne.id.toString(),
name: countryOne.name,
iso: countryOne.iso,
languages: countryOne.languages.toArray(),
},
{
id: countryTwo.id.toString(),
name: countryTwo.name,
iso: countryTwo.iso,
languages: countryTwo.languages.toArray(),
},
]);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,18 @@ describe('FindSuggestionsTermQueryHandler', () => {

const foundSuggestionsTerm = await findSuggestionsTermQueryHandler.execute(query);

expect(foundSuggestionsTerm.content).toEqual([term.toPrimitives()]);
expect(foundSuggestionsTerm.content).toEqual([
{
id: term.id,
title: term.title,
description: term.description,
example: term.example,
type: term.type.value,
hashtags: term.hashtags,
totalLikes: term.totalLikes,
createdAt: term.createdAt.toISOString(),
},
]);
});
});
});

0 comments on commit eaca44f

Please sign in to comment.