mcp-freescout/jest.setup.cjs
Jack Arturo 05b926fd37 Clean up formatting and update descriptions
Removed outdated Git workflow section from README and improved the description in server.json for clarity. Also cleaned up trailing whitespace and formatting in Jest config, setup, and test files for consistency.
2026-01-04 19:04:12 +01:00

48 lines
1.1 KiB
JavaScript

// Jest setup file for global test configuration
// Mock console methods to reduce noise in tests
global.console = {
...console,
error: jest.fn(),
warn: jest.fn(),
// Keep log for debugging
log: console.log,
info: console.info,
debug: console.debug,
};
// Set test environment variables
process.env.NODE_ENV = 'test';
// Global test utilities
global.testUtils = {
// Helper to wait for async operations
wait: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
// Helper to create mock FreeScout responses
mockTicket: (overrides = {}) => ({
id: 123,
number: 456,
subject: 'Test Ticket',
status: 'active',
state: 'published',
createdBy: { id: 1, email: 'user@example.com' },
customer: { id: 10, email: 'customer@example.com' },
threads: [],
cc: [],
bcc: [],
_embedded: {},
...overrides,
}),
mockThread: (overrides = {}) => ({
id: 1,
type: 'message',
status: 'active',
state: 'published',
body: 'Test message',
createdBy: { id: 1, email: 'user@example.com' },
createdAt: new Date().toISOString(),
...overrides,
}),
};