From eaca44f1d8c92f2f64b9ee25ce694ac6b80c33c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Peveri?= Date: Tue, 16 Jan 2024 21:32:33 +0100 Subject: [PATCH] Chore: Improvements in tests query handlers --- .../query/find/findCountryQueryHandler.test.ts | 7 ++++++- .../findAll/findCountriesQueryHandler.test.ts | 15 ++++++++++++++- .../findSuggestionsTermQueryHandler.test.ts | 13 ++++++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/test/languages/application/country/query/find/findCountryQueryHandler.test.ts b/test/languages/application/country/query/find/findCountryQueryHandler.test.ts index c535cf70..d6fed22f 100644 --- a/test/languages/application/country/query/find/findCountryQueryHandler.test.ts +++ b/test/languages/application/country/query/find/findCountryQueryHandler.test.ts @@ -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(), + }); }); }); }); diff --git a/test/languages/application/country/query/findAll/findCountriesQueryHandler.test.ts b/test/languages/application/country/query/findAll/findCountriesQueryHandler.test.ts index 92ab626c..8b3099bc 100644 --- a/test/languages/application/country/query/findAll/findCountriesQueryHandler.test.ts +++ b/test/languages/application/country/query/findAll/findCountriesQueryHandler.test.ts @@ -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(), + }, + ]); }); }); }); diff --git a/test/languages/application/term/suggestion/findSuggestionsTermQueryHandler.test.ts b/test/languages/application/term/suggestion/findSuggestionsTermQueryHandler.test.ts index 848750eb..ecf86853 100644 --- a/test/languages/application/term/suggestion/findSuggestionsTermQueryHandler.test.ts +++ b/test/languages/application/term/suggestion/findSuggestionsTermQueryHandler.test.ts @@ -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(), + }, + ]); }); }); });