@@ -30,9 +30,9 @@ describe("getOptimalTokenBalance", () => {
30
30
expect ( getOptimalTokenBalance ( balance ) ) . toBe ( tokenBalance ) ;
31
31
} ) ;
32
32
33
- it ( "should return the balance 1787372 .5556 if the balance is 1787372.5556 " , ( ) => {
34
- const balance = "1787372.5556 " ;
35
- const tokenBalance = "1787372 .5556 ZND" ;
33
+ it ( "should return the balance 1,787,372 .5556 if the balance is 1787372.55569 " , ( ) => {
34
+ const balance = "1787372.55569 " ;
35
+ const tokenBalance = "1,787,372 .5556 ZND" ;
36
36
37
37
expect ( getOptimalTokenBalance ( balance ) ) . toBe ( tokenBalance ) ;
38
38
} ) ;
@@ -72,6 +72,27 @@ describe("getOptimalTokenBalance", () => {
72
72
expect ( getOptimalTokenBalance ( balance ) ) . toBe ( tokenBalance ) ;
73
73
} ) ;
74
74
75
+ it ( "should return the balance 10,000.0 if the balance is 10000" , ( ) => {
76
+ const balance = "10000" ;
77
+ const tokenBalance = "10,000.0 ZOND" ;
78
+
79
+ expect ( getOptimalTokenBalance ( balance , "ZOND" ) ) . toBe ( tokenBalance ) ;
80
+ } ) ;
81
+
82
+ it ( "should return the balance 100,000.0 if the balance is 100000" , ( ) => {
83
+ const balance = "100000" ;
84
+ const tokenBalance = "100,000.0 ZOND" ;
85
+
86
+ expect ( getOptimalTokenBalance ( balance , "ZOND" ) ) . toBe ( tokenBalance ) ;
87
+ } ) ;
88
+
89
+ it ( "should return the balance 0.0 if the balance is a text `Zond`" , ( ) => {
90
+ const balance = "Zond" ;
91
+ const tokenBalance = "0.0 ZND" ;
92
+
93
+ expect ( getOptimalTokenBalance ( balance ) ) . toBe ( tokenBalance ) ;
94
+ } ) ;
95
+
75
96
it ( "should return the balance 1.9999 if the balance is 1.999999999999999999" , ( ) => {
76
97
const balance = "1.999999999999999999" ;
77
98
const tokenBalance = "1.9999 ZND" ;
@@ -92,4 +113,25 @@ describe("getOptimalTokenBalance", () => {
92
113
93
114
expect ( getOptimalTokenBalance ( balance , "XYZ" ) ) . toBe ( tokenBalance ) ;
94
115
} ) ;
116
+
117
+ it ( "should return the balance 3,453.5678 with the passed token symbol if the balance is 3453.567889" , ( ) => {
118
+ const balance = "3453.567889" ;
119
+ const tokenBalance = "3,453.5678 ZYZ" ;
120
+
121
+ expect ( getOptimalTokenBalance ( balance , "ZYZ" ) ) . toBe ( tokenBalance ) ;
122
+ } ) ;
123
+
124
+ it ( "should return the balance 100,000,000.0 with the passed token symbol if the balance is 100000000" , ( ) => {
125
+ const balance = "100000000" ;
126
+ const tokenBalance = "100,000,000.0 TOK" ;
127
+
128
+ expect ( getOptimalTokenBalance ( balance , "TOK" ) ) . toBe ( tokenBalance ) ;
129
+ } ) ;
130
+
131
+ it ( "should return the balance 23,000,000,000.0 if the balance is 23000000000" , ( ) => {
132
+ const balance = "23000000000" ;
133
+ const tokenBalance = "23,000,000,000.0 ZND" ;
134
+
135
+ expect ( getOptimalTokenBalance ( balance ) ) . toBe ( tokenBalance ) ;
136
+ } ) ;
95
137
} ) ;
0 commit comments