Fixes TypeScript compilation errors that prevented production build: - Fix invalid node shape type in integration test (diamond → circle) - Export WorkspaceSettings type from main types module - Exclude test files from production build TypeScript check All tests (368), linting, and build now pass successfully. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| INTEGRATION_TESTS_SUMMARY.md | ||
| README.md | ||
| store-synchronization.test.tsx | ||
Integration Tests
This directory contains integration tests for the Constellation Analyzer application.
Overview
Integration tests verify that multiple components and stores work together correctly. Unlike unit tests that test individual stores or functions in isolation, integration tests ensure that:
- Multiple stores synchronize state correctly
- Components respond properly to store changes
- Complex user flows work end-to-end
- State persists and loads correctly across documents
Test Files
document-lifecycle.test.tsx
Tests multi-document workflows including:
- Creating and switching between documents
- Preserving state when switching documents
- Deleting documents
- Persisting documents to localStorage
- Maintaining independent graph state for each document
graph-editing-history.test.tsx
Tests graph editing operations with history tracking:
- Undo/redo for node operations (add, delete, update)
- Undo/redo for edge operations
- Undo/redo for group operations
- History state management across documents
- Clearing redo stack when new actions are performed
timeline-state-management.test.tsx
Tests timeline/temporal state functionality:
- Creating new timeline states
- Cloning graph data when creating states
- Switching between timeline states
- Maintaining independent graph data for each state
- Preserving timeline state hierarchy (parent-child relationships)
- Timeline state persistence
Testing Approach
Store-First Testing
These integration tests primarily interact with stores directly rather than simulating UI interactions. This approach:
- Tests the core business logic integration
- Is more reliable than trying to find specific UI elements
- Runs faster than full UI interaction tests
- Is less brittle (doesn't break when UI changes)
When UI Interaction is Used
UI interactions are used when testing:
- Tab switching (document tabs)
- Undo/redo buttons
- Timeline state selection
This ensures that the UI properly triggers store actions.
Running the Tests
# Run all integration tests
npm run test:integration
# Run with UI
npm run test:ui
# Run with coverage
npm run test:coverage
Test Structure
Each test follows this pattern:
- Setup: Clear localStorage and reset stores
- Action: Perform operations through stores or UI
- Assertion: Verify expected state and behavior
- Cleanup: Tests use
beforeEachto ensure clean state
Future Enhancements
Potential areas for additional integration tests:
-
Search & Filter Integration
- Multi-store interaction between search and graph stores
- Filter combinations
- Search persistence across document switches
-
Bibliography Integration
- Citation management with graph elements
- Import/export of citation formats
- Bibliography persistence with documents
-
Type System Integration
- Creating custom actor/relation types
- Type persistence across documents
- Type deletion with existing actors/relations
-
Import/Export Workflows
- Full document export/import
- Workspace ZIP archives
- PNG/SVG image exports
Notes
- Integration tests use the same setup as unit tests (
src/test/setup.ts) - Tests run in a happy-dom environment for better performance
- localStorage is mocked and cleared between tests
- React Flow is rendered but interactions with the canvas are limited