/******************************************************************************* * (c) 2023 unipackage * * Licensed under either the MIT License (the "MIT License") or the Apache License, Version 2.0 * (the "Apache License"). You may not use this file except in compliance with one of these * licenses. You may obtain a copy of the MIT License at * * https://opensource.org/licenses/MIT * * Or the Apache License, Version 2.0 at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the MIT License or the Apache License for the specific language governing permissions and * limitations under the respective licenses. ********************************************************************************/ import { assert } from "chai" import { EnhanceNumber } from "@unipackage/utils" import { Balance, MarketBalance } from "../../src/basic/balance/types" import { describe, it } from "mocha" describe("Balance", () => { let balance: Balance beforeEach(() => { balance = new Balance(10, "fil") }) describe("#toEnhanceNumberFil", () => { it("should convert balance to EnhanceNumber in the specified denomination", () => { const enhanceNumber = balance.toEnhanceNumberFil("attofil") assert.instanceOf(enhanceNumber, EnhanceNumber) assert.deepStrictEqual( enhanceNumber.valueOf(), 10000000000000000000 ) }) }) }) describe("MarketBalance", () => { let marketBalance: MarketBalance beforeEach(() => { marketBalance = new MarketBalance({ Escrow: new Balance(10, "fil"), Locked: new Balance(10, "fil"), }) }) describe("#MarketBalance", () => { it("MarketBalance instance test", () => { assert.instanceOf(marketBalance, MarketBalance) }) }) })