UNPKG

@erfffun/utils

Version:

Energi javascript utilities for web development

18 lines (13 loc) 454 B
/* global describe, test, expect */ import amountToWei from '../index'; describe('Testing ETH conversion to Wei', () => { test('with both fixed and float parts', () => { expect(amountToWei('1.01', 18)).toBe('1010000000000000000'); }); test('with only float part', () => { expect(amountToWei('0.01', 18)).toBe('10000000000000000'); }); test('with only fixed part', () => { expect(amountToWei('1', 18)).toBe('1000000000000000000'); }); });