diff --git a/tests/utils.test.ts b/tests/utils.test.ts new file mode 100644 index 0000000..ad74fab --- /dev/null +++ b/tests/utils.test.ts @@ -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 { } \ No newline at end of file