react-native-format-currency 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/test/test.js +45 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-format-currency",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "A lightweight international currency formatter for React Native & Expo (iOS and Android).",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/test/test.js CHANGED
@@ -2,6 +2,15 @@
2
2
  var expect = require("chai").expect;
3
3
  var index = require("../dist/index.js");
4
4
  describe("formatCurrency function test", () => {
5
+ it("should return AED", () => {
6
+ var result = index.formatCurrency({ amount: 0.56, code: "AED" });
7
+ expect(result).to.eql(["AED 0.56", "0.56", "AED"]);
8
+ var result = index.formatCurrency({ amount: 1234.56, code: "AED" });
9
+ expect(result).to.eql(["AED 1,234.56", "1,234.56", "AED"]);
10
+ var result = index.formatCurrency({ amount: 1234567.89, code: "AED" });
11
+ expect(result).to.eql(["AED 1,234,567.89", "1,234,567.89", "AED"]);
12
+ });
13
+
5
14
  it("should return ARS", () => {
6
15
  var result = index.formatCurrency({ amount: 0.56, code: "ARS" });
7
16
  expect(result).to.eql(["$ 0,56", "0,56", "$"]);
@@ -20,6 +29,15 @@ describe("formatCurrency function test", () => {
20
29
  expect(result).to.eql(["$ 1,234,567.89", "1,234,567.89", "$"]);
21
30
  });
22
31
 
32
+ it("should return BAM", () => {
33
+ var result = index.formatCurrency({ amount: 0.56, code: "BAM" });
34
+ expect(result).to.eql(["KM 0.56", "0.56", "KM"]);
35
+ var result = index.formatCurrency({ amount: 1234.56, code: "BAM" });
36
+ expect(result).to.eql(["KM 1,234.56", "1,234.56", "KM"]);
37
+ var result = index.formatCurrency({ amount: 1234567.89, code: "BAM" });
38
+ expect(result).to.eql(["KM 1,234,567.89", "1,234,567.89", "KM"]);
39
+ });
40
+
23
41
  it("should return BBD", () => {
24
42
  var result = index.formatCurrency({ amount: 0.56, code: "BBD" });
25
43
  expect(result).to.eql(['$0.56', '0.56', '$' ]);
@@ -281,6 +299,15 @@ describe("formatCurrency function test", () => {
281
299
  expect(result).to.eql(["1,234,567.89 .د.م.", "1,234,567.89", ".د.م."]);
282
300
  });
283
301
 
302
+ it("should return MDL", () => {
303
+ var result = index.formatCurrency({ amount: 0.56, code: "MDL" });
304
+ expect(result).to.eql(["0.56 L", "0.56", "L"]);
305
+ var result = index.formatCurrency({ amount: 1234.56, code: "MDL" });
306
+ expect(result).to.eql(["1,234.56 L", "1,234.56", "L"]);
307
+ var result = index.formatCurrency({ amount: 1234567.89, code: "MDL" });
308
+ expect(result).to.eql(["1,234,567.89 L", "1,234,567.89", "L"]);
309
+ });
310
+
284
311
  it("should return MXN", () => {
285
312
  var result = index.formatCurrency({ amount: 0.56, code: "MXN" });
286
313
  expect(result).to.eql(["$ 0.56", "0.56", "$"]);
@@ -299,6 +326,15 @@ describe("formatCurrency function test", () => {
299
326
  expect(result).to.eql(["RM 1,234,567.89", "1,234,567.89", "RM"]);
300
327
  });
301
328
 
329
+ it("should return NGN", () => {
330
+ var result = index.formatCurrency({ amount: 0.56, code: "NGN" });
331
+ expect(result).to.eql(["₦0.56", "0.56", "₦"]);
332
+ var result = index.formatCurrency({ amount: 1234.56, code: "NGN" });
333
+ expect(result).to.eql(["₦1,234.56", "1,234.56", "₦"]);
334
+ var result = index.formatCurrency({ amount: 1234567.89, code: "NGN" });
335
+ expect(result).to.eql(["₦1,234,567.89", "1,234,567.89", "₦"]);
336
+ });
337
+
302
338
  it("should return NIO", () => {
303
339
  var result = index.formatCurrency({ amount: 0.56, code: "NIO" });
304
340
  expect(result).to.eql(['C$ 0.56', '0.56', 'C$' ]);
@@ -380,6 +416,15 @@ describe("formatCurrency function test", () => {
380
416
  expect(result).to.eql(["1,234,567.89L", "1,234,567.89", "L"]);
381
417
  });
382
418
 
419
+ it("should return RSD", () => {
420
+ var result = index.formatCurrency({ amount: 0.56, code: "RSD" });
421
+ expect(result).to.eql(["0.56RSD", "0.56", "RSD"]);
422
+ var result = index.formatCurrency({ amount: 1234.56, code: "RSD" });
423
+ expect(result).to.eql(["1,234.56RSD", "1,234.56", "RSD"]);
424
+ var result = index.formatCurrency({ amount: 1234567.89, code: "RSD" });
425
+ expect(result).to.eql(["1,234,567.89RSD", "1,234,567.89", "RSD"]);
426
+ });
427
+
383
428
  it("should return RUB", () => {
384
429
  var result = index.formatCurrency({ amount: 0.56, code: "RUB" });
385
430
  expect(result).to.eql(["0,56 p.", "0,56", "p."]);