mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-01 16:30:08 +00:00
* close test(utils): more test for Collection.ts #2793 * fix: after each not defined * close test(utils): more test for base64.ts #2796 * close test(utils): more test for casing.ts #2797 * test(utils): remove dev code * close #2799 * fix #2800 * close #2823 * test(utils): fix site move * close #2826 * refactor(utils): remove redundant if * close #2827 * close #2828
27 lines
965 B
TypeScript
27 lines
965 B
TypeScript
import { expect } from 'chai'
|
|
import { describe, it } from 'mocha'
|
|
import { Buffer } from 'node:buffer'
|
|
import { getBotIdFromToken, removeTokenPrefix } from '../src/token.js'
|
|
|
|
describe('token.ts', () => {
|
|
describe('token function', () => {
|
|
it('Will remove token prefix when Bot is prefixed.', () => {
|
|
expect(removeTokenPrefix('Bot discordeno is best lib')).to.be.equal('discordeno is best lib')
|
|
})
|
|
|
|
it('Will remove token prefix when Bot is NOT prefixed.', () => {
|
|
expect(removeTokenPrefix('discordeno is best lib')).to.be.equal('discordeno is best lib')
|
|
})
|
|
|
|
it('Will throw when token is undefined.', () => {
|
|
expect(() => removeTokenPrefix(undefined)).to.throw()
|
|
})
|
|
})
|
|
|
|
describe('getBotIdFromToken function', () => {
|
|
it('Will get Bot Id from token', () => {
|
|
expect(getBotIdFromToken(`${Buffer.from('1033452747380494366').toString('base64')}.zawsxedcrftvgybhu`)).to.equal(1033452747380494366n)
|
|
})
|
|
})
|
|
})
|