Skip to content

Commit

Permalink
Expand the test cases with some targets
Browse files Browse the repository at this point in the history
Refs #31, 6e98a7f
  • Loading branch information
thewilkybarkid committed Jul 11, 2024
1 parent 630667c commit f866f53
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion test/Iso3166.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,41 @@ import * as _ from '../src/lib/Iso3166.js'

describe('guessCountry', () => {
test.for([
['Czech Republic', 'CZ'],
['Czechia', 'CZ'],
['GHANA', 'GH'],
['UK', 'GB'],
['United Kingdom', 'GB'],
])('%s', ([input, expected]) => {
['united states', 'US'],
])('guesses %s', ([input, expected]) => {
const actual = _.guessCountry(input)

expect(actual).toStrictEqual(Option.some(expected))
})

test.for([
'Algiers ( Algeria)',
'Baylor College of Medicine, Houston, Texas',
'Beijing University of Technology, Beijing 100124, PR China',
'Chicago, IL, USA',
'Colorado - United States',
'Fayetteville GA (near Atlanta)',
'London',
'London, Ontario',
'London, UK',
'London, United Kingdom',
'Mars',
'New York City and Los Angeles',
'Québec',
'Rio de Janeiro, Brazil.',
'Southeast Asia',
'Sunnyvale, California',
'The UK',
'U.K.',
'Washington, DC',
])("doesn't guess %s", input => {
const actual = _.guessCountry(input)

expect(actual).toStrictEqual(Option.none())
})
})

0 comments on commit f866f53

Please sign in to comment.