UNPKG

@sofaws/dapp-core

Version:

A library to hold the main logic for a dapp on the Elrond Network

3 lines (2 loc) 2.55 kB
"use strict";import{a as m}from"../../../__chunks__/chunk-TAHC5Y63.js";import"../../../__chunks__/chunk-PDW7SVKQ.js";import"../../../__chunks__/chunk-I2NWMXXW.js";import"../../../__chunks__/chunk-V4XSYEH7.js";import"../../../__chunks__/chunk-JBJD3IUJ.js";import"../../../__chunks__/chunk-QFTWB3KE.js";import"../../../__chunks__/chunk-ZR7YL3KO.js";import"../../../__chunks__/chunk-27DX5WIQ.js";import"../../../__chunks__/chunk-X2JZA2ND.js";import"../../../__chunks__/chunk-MV7THB7B.js";import"../../../__chunks__/chunk-C32UB6VS.js";import{g as t,j as c}from"../../../__chunks__/chunk-NXNVZGZT.js";import"../../../__chunks__/chunk-OI3JNSRI.js";import"../../../__chunks__/chunk-6AJRSKSP.js";import"../../../__chunks__/chunk-TXKA5HXY.js";import"../../../__chunks__/chunk-C5OJNYCD.js";import"../../../__chunks__/chunk-3TSUQSLU.js";import"../../../__chunks__/chunk-7QE2X3X4.js";import"../../../__chunks__/chunk-CLAJ4EPW.js";import"../../../__chunks__/chunk-P6M5SGWP.js";import{a as n,b as a,m as r}from"../../../__chunks__/chunk-HBP5N4FR.js";r();c();import i from"react";import{render as d}from"@testing-library/react";var s=e=>d(i.createElement(m,a(n({},e),{egldLabel:"EGLD"}))).getByTestId("formatAmountComponent"),l=e=>{var o;return(o=e.querySelectorAll("span[data-testid=formatAmountDecimals]")[0])==null?void 0:o.textContent},p=e=>e.querySelectorAll("span[data-testid=formatAmountSymbol]").length;describe("Format amount component when digits = 2",()=>{it("should show 2 non zero decimals ",()=>{let o=s({value:"9999979999800000000000000",showLastNonZeroDecimal:!1,showLabel:!0,digits:2,egldLabel:t});expect(l(o)).toBe(".99")}),it("should show 2 zero decimals",()=>{let o=s({value:"9000000000000000000000000",showLastNonZeroDecimal:!1,showLabel:!0,digits:2,egldLabel:t});expect(l(o)).toBe(".00")}),it("should show all non zero decimals when showLastNonZeroDecimal = true",()=>{let o=s({value:"100000000000000",showLastNonZeroDecimal:!0,showLabel:!1,digits:2,egldLabel:t});expect(l(o)).toBe(".0001")}),it("should not show decimals when value is 0",()=>{let o=s({value:"100000000000000",showLastNonZeroDecimal:!1,showLabel:!0,digits:2,egldLabel:t});expect(l(o)).toBe(void 0)}),it("should show symbol",()=>{let o=s({value:"9000000000000000000000000",showLastNonZeroDecimal:!1,showLabel:!0,digits:2,egldLabel:t});expect(p(o)).toBe(1)}),it("should not show symbol",()=>{let o=s({value:"9000000000000000000000000",showLastNonZeroDecimal:!1,showLabel:!1,digits:2,egldLabel:t});expect(p(o)).toBe(0)})}); //# sourceMappingURL=formatAmountComponent.test.js.map