fix: test coverage change with few test

This commit is contained in:
Skillz
2023-03-03 19:47:29 -06:00
parent 5773c9e641
commit 147327b239
2 changed files with 40 additions and 1 deletions
+30
View File
@@ -40,6 +40,36 @@ describe('[rest] Message related tests', () => {
})
})
describe('Managing reactions', async () => {
it('Should add a unicode reaction', async () => {
const message = await rest.sendMessage('1041029705790402611', { content: 'testing rate limit manager' })
await rest.addReaction(message.channelId, message.id, '📙')
const reacted = await rest.getMessage(message.channelId, message.id)
expect(reacted.reactions?.length).to.be.greaterThanOrEqual(1)
it('Should delete a unicode reaction', async () => {
await rest.deleteOwnReaction(message.channelId, message.id, '📙')
const reacted = await rest.getMessage(message.channelId, message.id)
expect(reacted.reactions?.length).to.be.equal(0)
})
})
// it('Should add a custom reaction', async () => {
// const message = await rest.sendMessage('1041029705790402611', { content: 'testing rate limit manager' })
// await rest.addReaction(message.channelId, message.id, '<:discordeno:785403373817823272>')
// const reacted = await rest.getMessage(message.channelId, message.id)
// expect(reacted.reactions?.length).to.be.greaterThanOrEqual(1)
// it('Should delete a custom reaction', async () => {
// await rest.deleteOwnReaction(message.channelId, message.id, '<:discordeno:785403373817823272>')
// const reacted = await rest.getMessage(message.channelId, message.id)
// expect(reacted.reactions?.length).to.be.equal(0)
// })
// })
})
describe('Rate limit manager testing', () => {
it('Send 10 messages to 1 channel', async () => {
await Promise.all(
+10 -1
View File
@@ -1,8 +1,8 @@
import { expect } from 'chai'
import { afterEach, beforeEach, describe, it } from 'mocha'
import sinon from 'sinon'
import type { RestManager } from '../../src/types.js'
import { createRestManager } from '../../src/manager.js'
import type { RestManager } from '../../src/types.js'
import { fakeToken as token } from '../constants.js'
describe('[rest] manager', () => {
@@ -34,6 +34,15 @@ describe('[rest] manager', () => {
it('With a base url', () => {
expect(rest.baseUrl).to.be.equal(options.baseUrl)
})
it('With a falsy token', () => {
expect(() => createRestManager({ token: '' })).throws()
})
it('With an application id', () => {
const subrest = createRestManager({ ...options, applicationId: '130136895395987456' })
expect(subrest.applicationId).to.be.equal(130136895395987456n)
})
})
describe('rest.simplifyUrl', () => {