Refactors dependency injection and configuration management
Replaces global singleton configuration with dependency injection Introduces more modular and testable approach to configuration Removes direct references to calendarConfig in multiple components Adds explicit configuration passing to constructors Improves code maintainability and reduces global state dependencies
This commit is contained in:
parent
fb48e410ea
commit
8bbb2f05d3
30 changed files with 365 additions and 559 deletions
|
|
@ -16,16 +16,20 @@
|
|||
import { describe, it, expect, beforeEach } from 'vitest';
|
||||
import { EventStackManager } from '../../src/managers/EventStackManager';
|
||||
import { EventLayoutCoordinator } from '../../src/managers/EventLayoutCoordinator';
|
||||
import { calendarConfig } from '../../src/core/CalendarConfig';
|
||||
import { CalendarConfig } from '../../src/core/CalendarConfig';
|
||||
import { PositionUtils } from '../../src/utils/PositionUtils';
|
||||
import { DateService } from '../../src/utils/DateService';
|
||||
|
||||
describe('EventStackManager - Flexbox & Nested Stacking (3-Phase Algorithm)', () => {
|
||||
let manager: EventStackManager;
|
||||
let thresholdMinutes: number;
|
||||
let config: CalendarConfig;
|
||||
|
||||
beforeEach(() => {
|
||||
manager = new EventStackManager();
|
||||
config = new CalendarConfig();
|
||||
manager = new EventStackManager(config);
|
||||
// Get threshold from config - tests should work with any value
|
||||
thresholdMinutes = calendarConfig.getGridSettings().gridStartThresholdMinutes;
|
||||
thresholdMinutes = config.getGridSettings().gridStartThresholdMinutes;
|
||||
});
|
||||
|
||||
// ============================================
|
||||
|
|
@ -1128,7 +1132,9 @@ describe('EventStackManager - Flexbox & Nested Stacking (3-Phase Algorithm)', ()
|
|||
];
|
||||
|
||||
// Use EventLayoutCoordinator to test column allocation
|
||||
const coordinator = new EventLayoutCoordinator();
|
||||
const dateService = new DateService(config);
|
||||
const positionUtils = new PositionUtils(dateService, config);
|
||||
const coordinator = new EventLayoutCoordinator(manager, config, positionUtils);
|
||||
|
||||
if (thresholdMinutes >= 30) {
|
||||
// Calculate layout
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue