diff --git a/package.json b/package.json index 7127221..aae0592 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "build": "rimraf lib && rollup -c --bundleConfigAsCjs", "preparemetadata": "rimraf resources && node tools/prepare.js && rimraf resources/libphonenumber", "prepublishOnly": "yarn build", + "prettier": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", "test": "jest", "watch": "rimraf lib && rollup -cw" }, diff --git a/src/locales.ts b/src/locales.ts index 9d4412e..0eaf57f 100644 --- a/src/locales.ts +++ b/src/locales.ts @@ -1,3 +1,45 @@ /* THIS FILE IS AUTOGENERATED. */ -export type GeocoderLocale = 'ar' | 'be' | 'bg' | 'bs' | 'de' | 'el' | 'en' | 'es' | 'fa' | 'fi' | 'fr' | 'hr' | 'hu' | 'hy' | 'id' | 'it' | 'iw' | 'ja' | 'ko' | 'nl' | 'pl' | 'pt' | 'ro' | 'ru' | 'sq' | 'sr' | 'sv' | 'th' | 'tr' | 'uk' | 'vi' | 'zh' | 'zh_Hant'; -export type CarrierLocale = 'ar' | 'be' | 'en' | 'fa' | 'ko' | 'ru' | 'uk' | 'zh' | 'zh_Hant'; +export type GeocoderLocale = + | 'ar' + | 'be' + | 'bg' + | 'bs' + | 'de' + | 'el' + | 'en' + | 'es' + | 'fa' + | 'fi' + | 'fr' + | 'hr' + | 'hu' + | 'hy' + | 'id' + | 'it' + | 'iw' + | 'ja' + | 'ko' + | 'nl' + | 'pl' + | 'pt' + | 'ro' + | 'ru' + | 'sq' + | 'sr' + | 'sv' + | 'th' + | 'tr' + | 'uk' + | 'vi' + | 'zh' + | 'zh_Hant' +export type CarrierLocale = + | 'ar' + | 'be' + | 'en' + | 'fa' + | 'ko' + | 'ru' + | 'uk' + | 'zh' + | 'zh_Hant' diff --git a/test/carrier.test.ts b/test/carrier.test.ts new file mode 100644 index 0000000..fea2110 --- /dev/null +++ b/test/carrier.test.ts @@ -0,0 +1,10 @@ +import { carrier } from '../src' +import parsePhoneNumber from 'libphonenumber-js' + +describe('Phone Number Lookup', () => { + it('should return carrier', async () => { + const phoneNumber = parsePhoneNumber('+14158586273') + const res = carrier(phoneNumber) + expect(res).toEqual(null) + }) +}) diff --git a/src/index.test.ts b/test/index.test.ts similarity index 99% rename from src/index.test.ts rename to test/index.test.ts index daa3551..7d29a72 100644 --- a/src/index.test.ts +++ b/test/index.test.ts @@ -3,7 +3,7 @@ import { geocoder, parsePhoneNumberFromString, timezones, -} from './index' +} from '../src' it('geocodes with default locale en', async () => { const phoneNr = parsePhoneNumberFromString('+41431234567')