1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00
squid-js/test/utils/ConversionTypeHelpers.test.ts
2019-03-18 13:37:49 +01:00

28 lines
960 B
TypeScript

import { assert } from "chai"
import { zeroX, noZeroX } from "../../src/utils/ConversionTypeHelpers"
describe("ConversionTypeHelpers", () => {
describe("#zeroX()", () => {
it("should return the input if it's not hex value", async () => {
const result1 = zeroX("Test 1")
const result2 = noZeroX("Test 2")
assert.equal(result1, "Test 1")
assert.equal(result2, "Test 2")
})
it("should return the value with 0x prefix", async () => {
const result1 = zeroX("0x1234")
const result2 = zeroX("1234")
assert.equal(result1, "0x1234")
assert.equal(result2, "0x1234")
})
it("should return the value without 0x prefix", async () => {
const result1 = noZeroX("0x1234")
const result2 = noZeroX("1234")
assert.equal(result1, "1234",)
assert.equal(result2, "1234")
})
})
})