e118-iin-list
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -13,3 +13,3 @@ import csv from 'csv-parser'; | ||
.on('data', (data) => results.push(data)) | ||
.on('end', () => { | ||
.on('end', async () => { | ||
const list = results.reduce((list, { IssuerIdentifierNumber, CountryGeographicalarea, CompanyNameAddress, Contact, }) => { | ||
@@ -47,3 +47,3 @@ const [, countryCode, issuerIdentifierNumber] = IssuerIdentifierNumber[0].split(' '); | ||
}, {}); | ||
fs.writeFileSync(target, prettier.format([ | ||
fs.writeFileSync(target, await prettier.format([ | ||
`/* Auto-generated file. Do not change! */`, | ||
@@ -50,0 +50,0 @@ `import type { IssuerList } from './types';`, |
import { identifyIssuer } from './identifyIssuer.js'; | ||
describe('identifyIssuer', () => { | ||
it.each([ | ||
import { describe, it } from 'node:test'; | ||
import assert from 'node:assert/strict'; | ||
void describe('identifyIssuer', () => { | ||
for (const [iccid, issuer] of [ | ||
[ | ||
@@ -35,28 +37,22 @@ '89450421180216254864', | ||
], | ||
])('should identify the issuer', (iccid, issuer) => { | ||
expect(identifyIssuer(iccid)).toEqual(issuer); | ||
}); | ||
it('should not identify unknown issuers', () => { | ||
expect(identifyIssuer('123456')).toBeUndefined(); | ||
}); | ||
it('should identify US issuers which use leading 0', () => { | ||
expect(identifyIssuer('8901260866666666666F')).toEqual({ | ||
iin: 891260, | ||
countryCode: 1, | ||
issuerIdentifierNumber: '260', | ||
countryName: 'United States', | ||
companyName: 'T-Mobile USA', | ||
companyURLs: ['http://t-mobile.com'], | ||
}); | ||
}); | ||
it('should identify US issuers without leading 0', () => { | ||
expect(identifyIssuer('891260866666666666F')).toEqual({ | ||
iin: 891260, | ||
countryCode: 1, | ||
issuerIdentifierNumber: '260', | ||
countryName: 'United States', | ||
companyName: 'T-Mobile USA', | ||
companyURLs: ['http://t-mobile.com'], | ||
}); | ||
}); | ||
]) { | ||
void it(`should identify the ICCID ${iccid} as ${issuer}`, () => assert.deepEqual(identifyIssuer(iccid), issuer)); | ||
} | ||
void it('should not identify unknown issuers', () => assert.equal(identifyIssuer('123456'), undefined)); | ||
void it('should identify US issuers which use leading 0', () => assert.deepEqual(identifyIssuer('8901260866666666666F'), { | ||
iin: 891260, | ||
countryCode: 1, | ||
issuerIdentifierNumber: '260', | ||
countryName: 'United States', | ||
companyName: 'T-Mobile USA', | ||
companyURLs: ['http://t-mobile.com'], | ||
})); | ||
void it('should identify US issuers without leading 0', () => assert.deepEqual(identifyIssuer('891260866666666666F'), { | ||
iin: 891260, | ||
countryCode: 1, | ||
issuerIdentifierNumber: '260', | ||
countryName: 'United States', | ||
companyName: 'T-Mobile USA', | ||
companyURLs: ['http://t-mobile.com'], | ||
})); | ||
}); |
{ | ||
"name": "e118-iin-list", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "List of issuer identifier numbers for the international telecommunication charge card (ITU-T E.118)", | ||
@@ -12,3 +12,3 @@ "type": "module", | ||
"scripts": { | ||
"test": "jest", | ||
"test": "npx tsx --test src/*.spec.ts", | ||
"convert": "node dist/convert.js", | ||
@@ -38,8 +38,11 @@ "prepare": "husky install" | ||
"@commitlint/config-angular": "18.4.3", | ||
"@nordicsemiconductor/asset-tracker-cloud-code-style": "12.0.50", | ||
"@swc/jest": "0.2.29", | ||
"@types/jest": "29.5.4", | ||
"@nordicsemiconductor/asset-tracker-cloud-code-style": "13.0.0", | ||
"@nordicsemiconductor/eslint-config-asset-tracker-cloud-typescript": "17.0.0", | ||
"@types/node": "20.10.0", | ||
"@typescript-eslint/eslint-plugin": "6.13.1", | ||
"csv-parser": "3.0.0", | ||
"jest": "29.6.1", | ||
"eslint-config-prettier": "9.0.0", | ||
"eslint-plugin-import": "2.29.0", | ||
"eslint-plugin-prefer-arrow": "1.2.3", | ||
"eslint-plugin-unicorn": "49.0.0", | ||
"typescript": "5.3.2" | ||
@@ -89,14 +92,3 @@ }, | ||
], | ||
"jest": { | ||
"transform": { | ||
"^.+\\.(t|j)sx?$": [ | ||
"@swc/jest" | ||
] | ||
}, | ||
"moduleNameMapper": { | ||
"^(\\.{1,2}/.*)\\.js$": "$1" | ||
}, | ||
"testRegex": ".+\\.spec\\.ts$" | ||
}, | ||
"prettier": "@nordicsemiconductor/asset-tracker-cloud-code-style/.prettierrc" | ||
} |
298830
12
7598