testing bot login, added invoke for login

This commit is contained in:
Aster Fialla
2026-02-23 10:47:02 -05:00
parent a2bd7b755c
commit bfb5bf9cbb
2 changed files with 10 additions and 3 deletions

View File

@@ -58,7 +58,7 @@ const {commands} = require("../src/commands.js");
const {webhookHelper} = require("../src/helpers/webhookHelper.js");
const {utils} = require("../src/helpers/utils.js");
const {handleMessageCreate, client} = require("../src/bot.js");
let {handleMessageCreate, client, debounceLogin} = require("../src/bot.js");
env.config();
@@ -251,6 +251,13 @@ describe('bot', () => {
})
})
test('calls debounceLogin with correct argument', () => {
// Act
debounceLogin = jest.fn().mockResolvedValue();
// Assert
expect(debounceLogin).toHaveBeenCalledTimes(1);
expect(debounceLogin).toHaveBeenCalledWith(process.env.FLUXER_BOT_TOKEN)
})
afterEach(() => {
// restore the spy created with spyOn