Skip to main content
Glama
index.ts4.27 kB
/** * Universal Tool Test Helpers - Main Export Index * * This file provides a centralized export point for all universal tool test helpers, * making it easy for test files to import exactly what they need. * * Usage Examples: * * // For unit tests with mocks * import { setupUnitTestMocks, MockRecordFactory, assertionHelpers } from './helpers'; * * // For integration tests * import { IntegrationTestSetup, IntegrationTestDataManager } from './helpers'; * * // For performance tests * import { PerformanceTestRunner, PERFORMANCE_BUDGETS } from './helpers'; * * // For mixed usage * import { * MockParamsFactory, * testDataHelpers, * integrationConfig * } from './helpers'; */ // Local imports needed for convenience exports below import { setupUnitTestMocks, cleanupMocks } from './mock-setup.js'; import { MockRecordFactory } from './mock-data.js'; import { assertionHelpers } from './test-helpers.js'; import { IntegrationTestSetup, IntegrationTestDataManager, PerformanceTestRunner, integrationConfig, integrationUtils, } from './integration-helpers.js'; import { IntegrationDataFactory } from './mock-data.js'; import { PERFORMANCE_BUDGETS } from './test-constants.js'; // Test Constants and Configuration export { TEST_ENVIRONMENT, TEST_TIMEOUTS, PERFORMANCE_BUDGETS, BATCH_LIMITS, CLEANUP_DELAYS, RESOURCE_TYPES, DETAILED_INFO_TYPES, RELATIONSHIP_TYPES, CONTENT_SEARCH_TYPES, TIMEFRAME_TYPES, BATCH_OPERATION_TYPES, MOCK_SCHEMAS, DATE_PATTERNS, ERROR_MESSAGES, TEST_LOGGING, TEST_DATA_PATTERNS, performanceBudgetSoftCheck, } from './test-constants.js'; // Mock Data Factories export { type MockRecord, type MockError, MockRecordFactory, MockParamsFactory, MockResponseFactory, MockErrorFactory, IntegrationDataFactory, } from './mock-data.js'; // Mock Setup and Configuration export { mockSharedHandlers, mockErrorService, mockSchemasAndValidation, mockSpecializedHandlers, mockDateUtils, setupMockHandlers, setupMockErrorService, cleanupMocks, setupUnitTestMocks, setupErrorTestMocks, setupMocksWithConfig, getMockInstances, type MockSetupConfig, } from './mock-setup.js'; // Test Helper Utilities export { assertionHelpers, performanceHelpers, testDataHelpers, errorTestHelpers, mockVerificationHelpers, integrationHelpers, } from './test-helpers.js'; // Integration and Performance Test Helpers export { IntegrationTestSetup, IntegrationTestDataManager, PerformanceTestRunner, integrationConfig, integrationUtils, } from './integration-helpers.js'; /** * Convenience exports for common patterns */ // Most commonly used mock setup for unit tests export const setupCommonMocks = () => { return setupUnitTestMocks(); }; // Most commonly used assertion helpers export const commonAssertions = { // Will be populated when needed }; // Most commonly used test data factories export const commonFactories = { // Will be populated when needed }; // Environment detection utilities export const testEnvironment = { isCI: process.env.CI === 'true', shouldSkipIntegration: process.env.SKIP_INTEGRATION_TESTS === 'true', shouldSkipPerformance: process.env.SKIP_PERFORMANCE_TESTS === 'true', multiplier: process.env.CI === 'true' ? 2.5 : 1, }; /** * Helper function to determine which helpers to use based on test type */ export const getHelpersForTestType = ( testType: 'unit' | 'integration' | 'performance' ) => { switch (testType) { case 'unit': return { mockSetup: setupUnitTestMocks, dataFactories: MockRecordFactory, assertions: assertionHelpers, cleanup: cleanupMocks, }; case 'integration': return { setup: IntegrationTestSetup.getInstance(), dataManager: IntegrationTestDataManager, config: integrationConfig, utils: integrationUtils, assertions: assertionHelpers, }; case 'performance': return { runner: PerformanceTestRunner, budgets: PERFORMANCE_BUDGETS, config: integrationConfig, utils: integrationUtils, dataFactory: IntegrationDataFactory, }; default: throw new Error(`Unknown test type: ${testType}`); } };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kesslerio/attio-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server