mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-03 01:10:07 +00:00
* fix: readme runtime list * Fix code style issues with ESLint * node 18 * fix: websocket import type * fix: body for interaction requests * fix: perma fix for type error in ci * fix: followupmessage option type * fix: e2e tests exit bug * fix: color console logger * fix: image file sending * Fix code style issues with ESLint * guild and role methods * Fix code style issues with ESLint * fix: dont send heartbeat if socket is not open * fix: remove logs * fox: remove more logs * fix some bugs in role tests * Switch to after hook style * hoti's speed snaker * auto convert objects for discord * Fix code style issues with ESLint * fix: remove dup imports * fix: i hate linters * speeder * fix: tests delete guilds * Fix code style issues with ESLint * fix: easier to provide custom intents in bot * fix: shutdown bot after test * fix: add getGuild * fix: multiple guild delete attempts * fix: add emoji e2e tests * fix: remaining old e2e rest tests * Fix code style issues with ESLint --------- Co-authored-by: Lint Action <lint-action@samuelmeuli.com>
54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import chai, { expect } from 'chai'
|
|
import chaiAsPromised from 'chai-as-promised'
|
|
import { describe, it } from 'mocha'
|
|
import { e2ecache, rest } from './utils.js'
|
|
chai.use(chaiAsPromised)
|
|
|
|
before(async () => {
|
|
if (!e2ecache.guild) {
|
|
e2ecache.guild = await rest.createGuild({
|
|
name: 'Discordeno-test',
|
|
})
|
|
}
|
|
})
|
|
|
|
after(async () => {
|
|
if (rest.invalidBucket.timeoutId) clearTimeout(rest.invalidBucket.timeoutId)
|
|
if (e2ecache.guild.id && !e2ecache.deletedGuild) {
|
|
await rest.deleteGuild(e2ecache.guild.id)
|
|
}
|
|
})
|
|
|
|
describe('[rest] User related tests', () => {
|
|
describe('Get a user from the api', () => {
|
|
it('With a valid user id', async () => {
|
|
const user = await rest.getUser('130136895395987456')
|
|
|
|
describe('User has correct shape and form', () => {
|
|
it('Has correct id', () => {
|
|
expect(user.id).to.be.equal('130136895395987456')
|
|
})
|
|
|
|
it('Has a valid username', () => {
|
|
expect(user.username.length).to.be.greaterThanOrEqual(1)
|
|
})
|
|
|
|
it('Has a valid discriminator', () => {
|
|
expect(user.discriminator.length).to.be.equal(4)
|
|
})
|
|
|
|
it('Has been camelized', () => {
|
|
const keys = Object.keys(user)
|
|
|
|
expect(keys.includes('public_flags')).to.be.false
|
|
expect(keys.includes('publicFlags')).to.be.true
|
|
})
|
|
})
|
|
})
|
|
|
|
it('With an invalid user id', async () => {
|
|
await expect(rest.getUser('123')).eventually.throws
|
|
})
|
|
})
|
|
})
|