diff --git a/tests/setup.js b/tests/setup.js index 4e4467b..c31a654 100644 --- a/tests/setup.js +++ b/tests/setup.js @@ -10,11 +10,25 @@ * @see docs/ARCHITECT_PLAN.md - Phase 0, Task 0.3 */ -import { beforeAll, afterAll, beforeEach, afterEach } from 'bun:test'; +import { beforeAll, afterAll, beforeEach, afterEach, mock } from 'bun:test'; import fs from 'fs'; import os from 'os'; import path from 'path'; +// Mock node-notifier globally +mock.module('node-notifier', () => { + return { + default: { + notify: (options, callback) => { + if (callback) callback(null, 'ok'); + } + }, + notify: (options, callback) => { + if (callback) callback(null, 'ok'); + } + }; +}); + // ============================================================ // TEST ENVIRONMENT CONFIGURATION // ============================================================ diff --git a/tests/unit/ai-messages.test.js b/tests/unit/ai-messages.test.js index 9f7570c..30e2d12 100644 --- a/tests/unit/ai-messages.test.js +++ b/tests/unit/ai-messages.test.js @@ -127,7 +127,7 @@ describe('AI Message Generation Module', () => { json: () => Promise.resolve({ choices: [{ message: { - content: 'a'.repeat(201) + content: 'a'.repeat(501) } }] }) diff --git a/tests/unit/desktop-notify.test.js b/tests/unit/desktop-notify.test.js index 1107b39..be8fe99 100644 --- a/tests/unit/desktop-notify.test.js +++ b/tests/unit/desktop-notify.test.js @@ -18,29 +18,6 @@ import { // Store original os.platform for restoration let originalPlatform; -// Mock notifier at module level -let mockNotify; -let mockNotifyCallback; - -/** - * Sets up a mock for node-notifier. - * We need to use dynamic import and module mocking. - */ -const setupNotifierMock = () => { - mockNotifyCallback = null; - mockNotify = mock((options, callback) => { - mockNotifyCallback = callback; - // By default, simulate successful notification - if (callback) { - callback(null, 'ok'); - } - }); - - return { - notify: mockNotify - }; -}; - describe('desktop-notify module', () => { // Import the module fresh for each test let desktopNotify;