From f866f53b59cdfafa7d9ac5e7958d0c41581171f2 Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Thu, 11 Jul 2024 10:41:10 +0100 Subject: [PATCH] Expand the test cases with some targets Refs #31, 6e98a7f5e74d31471be187983c161cd45163ef7f --- test/Iso3166.test.ts | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/test/Iso3166.test.ts b/test/Iso3166.test.ts index 061f436..2f6c2d2 100644 --- a/test/Iso3166.test.ts +++ b/test/Iso3166.test.ts @@ -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()) + }) })