- Pre-compile all regex patterns as module-level constants in parser.js and jsonRepair.js - Add format detection caching (lastDetectedFormat, formatCacheHits) to skip redundant checks - Add clearFormatCache() export for cache invalidation - Add comprehensive test suite (33 tests) for parser and jsonRepair modules - Fix regex escaping in dynamic patterns (statRegex, fieldRegex) - Improve toFieldKey() regex specificity
23 lines
539 B
JavaScript
23 lines
539 B
JavaScript
// Jest setup file - set up mocks before tests run
|
|
const mockState = {
|
|
extensionSettings: {
|
|
debugMode: false,
|
|
userStats: {},
|
|
trackerConfig: {},
|
|
quests: { main: '', optional: [] }
|
|
},
|
|
FEATURE_FLAGS: { useNewInventory: false },
|
|
addDebugLog: () => {}
|
|
};
|
|
|
|
const mockPersistence = {
|
|
saveSettings: () => {}
|
|
};
|
|
|
|
const mockInventoryParser = {
|
|
extractInventory: () => null
|
|
};
|
|
|
|
// We can't easily mock ESM imports in Jest without transform
|
|
// Instead, we'll create mock files that Jest can use
|