Skip to content

Commit

Permalink
Restored coverage to 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
marcokreeft87 committed Jan 1, 2023
1 parent 680a155 commit 7634e1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ export const getCountryFlagByName = (countryName: string) => {
}

const country = countries.filter(x => x.Country === countryName)[0];
if(country == undefined) {
throw new Error(`${countryName} not found`);
}

return getCountryFlagUrl(country.Code);
}
Expand Down
6 changes: 6 additions & 0 deletions tests/utils/getCountryFlagUrl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ describe('Testing util file function getCountryFlagUrl', () => {
test('Passing UAE should return expected flag url', () => {
expect(getCountryFlagUrl('UAE')).toBe('https://flagcdn.com/w40/ae.png')
}),
test('Passing USA should return expected flag url', () => {
expect(getCountryFlagByName('USA')).toBe('https://flagcdn.com/w40/us.png')
}),
test('Passing UAE should return expected flag url', () => {
expect(getCountryFlagByName('UAE')).toBe('https://flagcdn.com/w40/ae.png')
}),
test('Passing Saudi Arabia should return expected flag url', () => {
expect(getCountryFlagUrl('Saudi-Arabia')).toBe('https://flagcdn.com/w40/saudi-arabia.png')
})
Expand Down

0 comments on commit 7634e1a

Please sign in to comment.