Skip to main content

Integration Tests (tests/)

Headless C++ testing framework for the Songbird DAW’s core engine, audio processing, and internal plugins.

Architecture

The testing framework revolves around the SongbirdAppCore static library. The monolith application backend has been decoupled from the SongbirdPlayer GUI wrapper, allowing us to link all core capabilities natively into the SongbirdIntegrationTests command-line binary. Our test components run without initializing a JUCE MessageManager GUI window context, enabling fast and robust CI compatibility.

Key Components

  • IntegrationTestUtils.h: Utilities to cleanly spool up a Tracktion Engine and dummy Edit. Provides HeadlessEngineBehaviour which taps into the Tracktion plugin builder API to properly hydrate Songbird’s custom plugins (e.g., SongbirdChannelStrip) by recognizing their string Type identifiers.
  • test_main.cpp: Main test runner — comprehensive integration tests covering bird file parsing, state management, and engine operations.
  • test_plugins.cpp: Active juce::UnitTest definitions that push plugins into the dummy engine, alter parameters, and validate output assertions.

Running the Tests

To compile and execute the tests:
# From the project root
cmake --build build --target SongbirdIntegrationTests -j 4
./build/SongbirdTests_artefacts/SongbirdIntegrationTests
Or use the validation script:
./utils/validate.sh cpp

Writing Tests

  1. Add your new test juce::UnitTest struct inside test_plugins.cpp or add a new test_*.cpp file.
  2. If adding a new .cpp file, ensure to append it to the SongbirdIntegrationTests target in the project root’s CMakeLists.txt.
  3. Leverage songbird_testing::IntegrationTestSetup to get an instant sandbox Tracktion engine without UI bindings.

React UI Tests (Vitest)

The React frontend uses Vitest for unit testing. Tests live alongside the code they test.
cd react_ui
npx vitest run          # Run all tests once
npx vitest              # Watch mode

AI Copilot Tests (src/lib/ai/)

SuiteTestsWhat it covers
bird/__tests__/parser.test.ts34Tokenizer (10), parser (5), validator (8), edge cases (11)
core/__tests__/compactor.test.ts7Threshold behavior, LLM summarization, fallback, caching
cache/__tests__/context-cache.test.ts10Cache creation/reuse, invalidation, API failure, payload

Store Tests (src/data/)

SuiteWhat it covers
slices/chat.test.tsChat message and thread management
slices/generate.test.tsAI generation job lifecycle
slices/mixer.test.tsTrack, section, and plugin state
slices/transport.test.tsTransport playback and position
store.test.tsStore integration and persistence
sliderDrag.test.tsSlider drag tracking utility