Skip to content

Commit 9d314e1

Browse files
committed
Add failing test case to investigate
1 parent 18a2fb7 commit 9d314e1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/sdk/test/ci/plt/TokenAmount.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ describe('PLT TokenAmount', () => {
1212
expect(TokenAmount.fromDecimal('15.002456687544126548', 18)).toEqual(
1313
TokenAmount.create(15002456687544126548n, 18)
1414
);
15+
expect(TokenAmount.fromDecimal(MAX_U64, 0)).toEqual(
16+
TokenAmount.create(MAX_U64, 0)
17+
);
1518
});
1619

1720
test('Parses large decimal values correctly', () => {
@@ -35,6 +38,11 @@ describe('PLT TokenAmount', () => {
3538
expect(() => TokenAmount.fromDecimal(99999999999999999999999999n, 1)).toThrow(
3639
TokenAmount.Err.exceedsMaxValue()
3740
);
41+
42+
});
43+
44+
test('Token amounts with more decimals than specified throws', () => {
45+
expect(() => TokenAmount.fromDecimal('1.000003', 0)).toThrow('The amount has more decimal places than the specified decimals.');
3846
});
3947

4048
test('Returns expected amount', () => {

0 commit comments

Comments
 (0)