Files
discordeno/packages/utils/tests/hash.spec.ts
Jonathan Ho eaf8782d34 test: fix rest and utils test (#2723)
* test(utils): fix  cant import collection

* test(rest): await expect

* fix(utils): deno compactability

* test(utils): typing

* fix(utils): add return type
2023-01-15 11:04:20 -06:00

28 lines
945 B
TypeScript

/* eslint-disable @typescript-eslint/naming-convention */
import { expect } from 'chai'
import { describe, it } from 'mocha'
import { iconBigintToHash, iconHashToBigInt } from '../src/hash.js'
const iconHash = '4bbb271a13f7195031adcc06a2d867ce'
const iconBigInt = 3843769888406823508519992434416504301518n
const a_iconHash = 'a_4bbb271a13f7195031adcc06a2d867ce'
const a_iconBigInt = 3503487521485885045056617826984736090062n
describe('hash.ts', () => {
it('[utils] icon hash to bigint', () => {
expect(iconHashToBigInt(iconHash)).to.be.equal(iconBigInt)
})
it('[utils] icon bigint to hash', () => {
expect(iconBigintToHash(iconBigInt)).to.be.equal(iconHash)
})
it('[utils] icon hash to bigint a_ (animated)', () => {
expect(iconHashToBigInt(a_iconHash)).to.be.equal(a_iconBigInt)
})
it('[utils] icon bigint to hash a_ (animated)', () => {
expect(iconBigintToHash(a_iconBigInt)).to.be.equal(a_iconHash)
})
})