Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion tests/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
// ============================================================
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/ai-messages.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ describe('AI Message Generation Module', () => {
json: () => Promise.resolve({
choices: [{
message: {
content: 'a'.repeat(201)
content: 'a'.repeat(501)
}
}]
})
Expand Down
23 changes: 0 additions & 23 deletions tests/unit/desktop-notify.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down