mirror of
https://gh.wpcy.net/https://github.com/verygoodplugins/mcp-freescout.git
synced 2026-07-16 08:48:39 +08:00
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.
48 lines
1.1 KiB
JavaScript
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,
|
|
}),
|
|
};
|