test(bf-3oy5): fix mock setup for SemanticNarrativePanel tests
Fixed the mock setup for the SemanticNarrativeManager to properly allow mockReturnValue() to work on the manager methods. The issue was that the mock class methods were defined as class properties with vi.fn(() => null), which created new instances for each test run. By defining the mock functions as module-level variables and assigning them to the class methods, we ensure that the same vi.fn() instances are used throughout, allowing tests to properly configure return values with mockReturnValue(). This fixes 3 failing tests: - "should refresh narrative from manager" - "should generate narrative for worker and set it" - "should generate aggregated narrative and set it" Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
cd24f596f7
commit
5ff569a67a
1 changed files with 8 additions and 3 deletions
|
|
@ -56,10 +56,15 @@ vi.mock('../utils/colors.js', () => ({
|
|||
}));
|
||||
|
||||
// Mock semanticNarrative module - create a proper class mock
|
||||
// Define functions outside the mock to allow test access
|
||||
const generateNarrativeFn = vi.fn(() => null);
|
||||
const generateAggregatedNarrativeFn = vi.fn(() => null);
|
||||
const getNarrativeFn = vi.fn(() => null);
|
||||
|
||||
class MockSemanticNarrativeManager {
|
||||
generateNarrative = vi.fn(() => null);
|
||||
generateAggregatedNarrative = vi.fn(() => null);
|
||||
getNarrative = vi.fn(() => null);
|
||||
generateNarrative = generateNarrativeFn;
|
||||
generateAggregatedNarrative = generateAggregatedNarrativeFn;
|
||||
getNarrative = getNarrativeFn;
|
||||
}
|
||||
|
||||
// Create singleton instance
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue