tests: configured test

This commit is contained in:
원더 2021-01-19 22:02:43 +09:00
parent 4e5832cb83
commit 8d4578e772

26
tests/utils.test.ts Normal file
View File

@ -0,0 +1,26 @@
import { DiscordEnpoints } from '../utils/Constants'
import { checkPerm, formatNumber } from '../utils/Tools'
test('format Number', () => {
expect(formatNumber(1000)).toBe('1천')
expect(formatNumber(33333)).toBe('3.3만')
expect(formatNumber(600)).toBe('600')
expect(formatNumber(1300)).toBe('1천')
expect(formatNumber(9999)).toBe('1만')
expect(formatNumber(959999)).toBe('96만')
expect(formatNumber(999999)).toBe('100만')
})
test('checking Permission', () => {
expect(checkPerm(0x0, 0x0)).toBe(true)
expect(checkPerm(0x1, 0x2)).toBe(false)
expect(checkPerm(7, 'booster')).toBe(true)
expect(checkPerm(0, 'staff')).toBe(false)
expect(checkPerm(0x2, 'staff')).toBe(false)
})
test('check CDN URL', () => {
expect(DiscordEnpoints.CDN.user('000000000000000000', 'abcdefghijklm', { format: 'jpg', size: 1024 })).toBe('https://cdn.discordapp.com/avatars/000000000000000000/abcdefghijklm.jpg?size=1024')
})
export { }