test(bf-3oy5): fix mock setup for SemanticNarrativePanel tests
The vi.mock() callback was capturing mockManagerInstance at module load time when it was undefined. Fixed by: 1. Changing mock to vi.fn() without return value 2. Adding mockReturnValue(mockManagerInstance) in beforeEach This ensures the mock returns the properly configured instance when getSemanticNarrativeManager() is called during panel construction. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
0e849ef220
commit
a6019cc82d
1 changed files with 4 additions and 1 deletions
|
|
@ -75,7 +75,7 @@ class MockSemanticNarrativeManager {
|
|||
let mockManagerInstance: MockSemanticNarrativeManager;
|
||||
|
||||
vi.mock('../../semanticNarrative.js', () => ({
|
||||
getSemanticNarrativeManager: vi.fn(() => mockManagerInstance),
|
||||
getSemanticNarrativeManager: vi.fn(),
|
||||
}));
|
||||
|
||||
// Import after mocking
|
||||
|
|
@ -203,6 +203,9 @@ describe('SemanticNarrativePanel', () => {
|
|||
mockManagerInstance.onUpdate = vi.fn(() => () => {});
|
||||
mockManagerInstance.clear = vi.fn();
|
||||
|
||||
// Update the mock to return the new instance
|
||||
(getSemanticNarrativeManager as Mock).mockReturnValue(mockManagerInstance);
|
||||
|
||||
mockScreen = createMockScreen();
|
||||
onSelectCallback = vi.fn();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue