UNPKG

@aerapass/country-data

Version:

Data about countries - like their ISO codes and currencies

49 lines 1.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const __1 = require("../"); const _ = require("underscore"); test('countries should be an array', () => { expect(__1.countries.all).toBeInstanceOf(Array); }); test('should find country by alpha2', () => { expect(__1.countries.US.name).toEqual('United States'); }); test('should prefer assigned alpha2 country codes', () => { expect(__1.countries.SK.name).toEqual('Slovakia'); }); test('should find country by alpha3', () => { expect(__1.countries.FRA.name).toEqual('France'); expect(__1.countries.FRA.currencies).toEqual(['EUR']); }); _.each(__1.countries.all, (country) => { test('should have a status', () => { expect(country.status).toBeDefined(); }); test('should have correctly formed alpha2 and alpha3', () => { expect(country.alpha2.match(/^[A-Z]{2}$/)).toBeTruthy(); if (country.alpha3.length) { expect(country.alpha3.match(/^[A-Z]{3}$/)).toBeTruthy(); } }); }); _.each(__1.countries.all, (country) => { _.each(country.currencies, (currency) => { test('check currencies for each country', () => { expect(__1.currencies[currency]).toBeDefined(); }); }); }); test('check specific country currencies', () => { expect(__1.countries.LV.currencies).toEqual(['EUR']); }); test('check emoji for a specific country', () => { expect(__1.countries.FI.emoji).toEqual(String.fromCharCode(55356, 56811, 55356, 56814)); }); _.each(__1.countries.all, (country) => { _.each(country.languages, (language) => { test('check languages for each country', () => { expect(__1.languages[language]).toBeDefined(); }); }); }); //# sourceMappingURL=countries.test.js.map