Skip to content

Commit

Permalink
new feature: currency ZWG
Browse files Browse the repository at this point in the history
  • Loading branch information
karczk-dnv committed Jun 26, 2024
1 parent 235bf03 commit d083e56
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 8 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,32 @@
# Changelog
Strictly follows [Semantic Versioning 2.0.0.](https://semver.org/)

## v1.16.0
`2024-06-26`\
\
🚀 Features:
- support for `ZWG` currency: [`findIso4217Currency()`](DOCUMENTATION.md#findIso4217Currency) and [`findIso4217CurrencyForIso3166Country()`](DOCUMENTATION.md#findIso4217CurrencyForIso3166Country)

```typescript
{
alpha3Code: "ZWG", // NEW
currencyName: "Zimbabwe Gold", // NEW
numericCode: 924, // NEW
minorUnit: 2, // NEW
introducedIn: "2024-06-25" // NEW
},
{
alpha3Code: "ZWL",
currencyName: "Zimbabwe Dollar",
numericCode: 932,
minorUnit: 2,
historicalFrom: "2024-09-01" // CHANGED (before: undefined)
}
```

🔧 Internal:
- TypeScript upgrade `5.4.5` -> `5.5.2`

## v1.15.0
`2024-05-10`\
\
Expand Down
26 changes: 25 additions & 1 deletion __tests__/getIso4217Currencies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('getIso4217Currencies', () => {
expect(countries.every(x => x.introducedIn === undefined || x.introducedIn.length === 10)).toBeTruthy();
});

test('Kuna currency is not returned', () => {
test('Kuna (HRK) currency is not returned', () => {
const countries = getIso4217Currencies("2023-01-01");
expect(countries).toHaveLength(180);
expect(countries.find(x => x.alpha3Code === "HRK")).toBeUndefined();
Expand All @@ -41,6 +41,30 @@ describe('getIso4217Currencies', () => {
expect(countries.find(x => x.alpha3Code === "ANG")).toBeUndefined();
});

test('Zimbabwe Gold (ZWG) currency is not returned', () => {
const countries = getIso4217Currencies("2024-06-24");
expect(countries).toHaveLength(180);
expect(countries.find(x => x.alpha3Code === "ZWG")).toBeUndefined();
});

test('Zimbabwe Gold (ZWG) currency is returned', () => {
const countries = getIso4217Currencies("2024-06-25");
expect(countries).toHaveLength(181);
expect(countries.find(x => x.alpha3Code === "ZWG")).toBeDefined();
});

test('Zimbabwe Dollar (ZWL) currency is not returned', () => {
const countries = getIso4217Currencies("2024-09-01");
expect(countries).toHaveLength(180);
expect(countries.find(x => x.alpha3Code === "ZWL")).toBeUndefined();
});

test('Zimbabwe Dollar (ZWL) currency is returned', () => {
const countries = getIso4217Currencies("2024-08-31");
expect(countries).toHaveLength(181);
expect(countries.find(x => x.alpha3Code === "ZWL")).toBeDefined();
});

test('function should return the same reference', () => {
const countries1 = getIso4217Currencies("2022-12-31");
const countries2 = getIso4217Currencies("2022-12-31");
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dnvgl/i18n",
"version": "1.15.0",
"version": "1.16.0",
"description": "A set of functions to support multiple languages/cultures in a browser or Node.js",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
Expand Down Expand Up @@ -34,7 +34,7 @@
"license": "MIT",
"devDependencies": {
"@types/jest": "^29.5.12",
"@types/node": "^20.14.8",
"@types/node": "^20.14.9",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"rimraf": "^5.0.7",
Expand Down
10 changes: 9 additions & 1 deletion src/internal/iso4217Currencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1099,10 +1099,18 @@ export const iso4217Currencies: Iso4217Currency[] = [
numericCode: 967,
minorUnit: 2
},
{
alpha3Code: "ZWG",
currencyName: "Zimbabwe Gold",
numericCode: 924,
minorUnit: 2,
introducedIn: "2024-06-25"
},
{
alpha3Code: "ZWL",
currencyName: "Zimbabwe Dollar",
numericCode: 932,
minorUnit: 2
minorUnit: 2,
historicalFrom: "2024-09-01"
}
];
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -696,10 +696,10 @@
dependencies:
undici-types "~5.26.4"

"@types/node@^20.14.8":
version "20.14.8"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.8.tgz#45c26a2a5de26c3534a9504530ddb3b27ce031ac"
integrity sha512-DO+2/jZinXfROG7j7WKFn/3C6nFwxy2lLpgLjEXJz+0XKphZlTLJ14mo8Vfg8X5BWN6XjyESXq+LcYdT7tR3bA==
"@types/node@^20.14.9":
version "20.14.9"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.9.tgz#12e8e765ab27f8c421a1820c99f5f313a933b420"
integrity sha512-06OCtnTXtWOZBJlRApleWndH4JsRVs1pDCc8dLSQp+7PpUpX3ePdHyeNSFTeSe7FtKyQkrlPvHwJOW3SLd8Oyg==
dependencies:
undici-types "~5.26.4"

Expand Down

0 comments on commit d083e56

Please sign in to comment.