diff --git a/packages/rest/tests/e2e/message.spec.ts b/packages/rest/tests/e2e/message.spec.ts index 172938205..a9a6916fc 100644 --- a/packages/rest/tests/e2e/message.spec.ts +++ b/packages/rest/tests/e2e/message.spec.ts @@ -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( diff --git a/packages/rest/tests/unit/manager.spec.ts b/packages/rest/tests/unit/manager.spec.ts index 55bd39b30..ba526be57 100644 --- a/packages/rest/tests/unit/manager.spec.ts +++ b/packages/rest/tests/unit/manager.spec.ts @@ -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', () => {