forked from syntaxbullet/aurorabot
refactor: convert LootdropService from class to singleton object pattern
- Move instance properties to module-level state (channelActivity, channelCooldowns) - Convert constructor cleanup interval to module-level initialization - Export state variables for testing - Update tests to use direct state access instead of (service as any) - Maintains same behavior while following project service pattern Closes #4
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect, mock, beforeEach, afterEach, spyOn } from "bun:test";
|
||||
import { lootdropService } from "@shared/modules/economy/lootdrop.service";
|
||||
import { lootdropService, channelActivity, channelCooldowns } from "@shared/modules/economy/lootdrop.service";
|
||||
import { lootdrops } from "@db/schema";
|
||||
import { economyService } from "@shared/modules/economy/economy.service";
|
||||
|
||||
@@ -67,8 +67,8 @@ describe("lootdropService", () => {
|
||||
mockFrom.mockClear();
|
||||
|
||||
// Reset internal state
|
||||
(lootdropService as any).channelActivity = new Map();
|
||||
(lootdropService as any).channelCooldowns = new Map();
|
||||
channelActivity.clear();
|
||||
channelCooldowns.clear();
|
||||
|
||||
// Mock Math.random
|
||||
originalRandom = Math.random;
|
||||
|
||||
Reference in New Issue
Block a user