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/GeneratorHelpers.test.ts

33 lines
795 B
TypeScript
Raw Normal View History

2019-02-14 12:37:52 +01:00
import { assert } from "chai"
import { generateId } from "../../src/utils/GeneratorHelpers"
describe("GeneratorHelpers", () => {
describe("#generateId()", () => {
it("should generate an ID", async () => {
const id = generateId()
assert(id)
})
it("should generate an ID that is 64 chars long", async () => {
const id: string = generateId()
assert.equal(id.length, 64)
})
it("should not contain -", async () => {
const id: string = generateId()
assert.match(id, /^[a-f0-9]+$/i)
})
it("should generate an ID that is 130 chars long", async () => {
const id: string = generateId(130)
assert.equal(id.length, 130)
})
})
})