edited bot to have top level main function

This commit is contained in:
Aster Fialla
2026-02-24 16:18:40 -05:00
parent 8b8cdd6d12
commit 2bf218683a
2 changed files with 14 additions and 4 deletions

View File

@@ -65,6 +65,7 @@ const {webhookHelper} = require("../src/helpers/webhookHelper.js");
const {utils} = require("../src/helpers/utils.js");
let {handleMessageCreate, client} = require("../src/bot.js");
const {login} = require("../src/bot");
describe('bot', () => {
beforeEach(() => {
@@ -290,9 +291,11 @@ describe('bot', () => {
})
})
test('calls client.login with correct argument', () => {
// Act
test('login calls client.login with correct argument', async() => {
// Arrange
client.login = jest.fn().mockResolvedValue();
// Act
await login();
// Assert
expect(client.login).toHaveBeenCalledTimes(1);
expect(client.login).toHaveBeenCalledWith(process.env.FLUXER_BOT_TOKEN)