Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f313094
Add AGENTS.md
chrisballinger Sep 17, 2025
dbb551f
Document tracks service architecture plan
chrisballinger Sep 17, 2025
99b8cbd
Cleanup
chrisballinger Oct 18, 2025
348132d
Update project settings
chrisballinger Oct 18, 2025
0a31f92
Add protocol-based composable query foundation to PlayaDB
chrisballinger Oct 19, 2025
dac3b3f
Fix tests
chrisballinger Oct 19, 2025
894719f
Add comprehensive tests for protocol-based query extensions
chrisballinger Oct 19, 2025
ef581c6
Working on impl
chrisballinger Oct 19, 2025
f56a860
Add filter request builder coverage and fix FTS matching
chrisballinger Oct 19, 2025
e07122d
Add filtered observation APIs and tests
chrisballinger Oct 19, 2025
a875e49
Support favorites filtering for filtered queries
chrisballinger Oct 19, 2025
3f06709
Support art filters constrained to event-linked installations
chrisballinger Oct 19, 2025
9c2cd7f
Ensure metadata hydration across filtered PlayaDB queries
chrisballinger Oct 19, 2025
598108d
Hydrate metadata for aggregate queries and metadata API
chrisballinger Oct 19, 2025
68d5751
Introduce hashable filter region storage
chrisballinger Oct 19, 2025
485f267
Refactor query extensions with generic column providers
chrisballinger Oct 19, 2025
4433528
Fix audio toggle tests by posting notification in MockAudioService
chrisballinger Oct 25, 2025
b1d80d8
Document audio test fix
chrisballinger Oct 25, 2025
d4f26ea
WIP: Implement SwiftUI list views Phase 1 & 2 foundations
chrisballinger Oct 25, 2025
11e65f6
Document liquid glass support plan
chrisballinger Jan 10, 2026
7176ef5
Apply glass appearances to bars
chrisballinger Jan 10, 2026
dddc51d
Finish GRDB list view MVP
chrisballinger Jan 10, 2026
db035eb
Merge branch 'liquid-glass-mvp' into grdb-1
chrisballinger Jan 10, 2026
31cc05b
more liquid glass
chrisballinger Jan 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
284 changes: 284 additions & 0 deletions Docs/2025-09-16-tracks-feature-plan.md

Large diffs are not rendered by default.

401 changes: 401 additions & 0 deletions Docs/2025-10-19-grdb-composable-queries.md

Large diffs are not rendered by default.

100 changes: 100 additions & 0 deletions Docs/2025-10-25-audio-test-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Fix Audio Toggle Tests - 2025-10-25

## Problem Statement

The `testCellTapAudioTogglesPlayback` test was failing with:
```
XCTAssertTrue(viewModel.isAudioPlaying) failed
```

## Root Cause Analysis

The test failure had two issues:

1. **MockAudioService wasn't posting notifications**: The real `BRCAudioPlayer` posts `BRCAudioPlayerChangeNotification` when audio state changes, but the mock service wasn't doing this. The `DetailViewModel` depends on this notification to update its `isAudioPlaying` state.

2. **Test using wrong art object**: The tests were creating audio cells with `artObjectWithAudio`, but using the default `viewModel` which was initialized with a regular `artObject` (without audio URL). When the notification arrived, `updateAudioPlayingState()` would check if the viewModel's `dataObject` had an audio URL, and it didn't.

## Solution

### 1. Updated MockAudioService (`MockServices.swift`)

Added notification posting in `playAudio()` and `pauseAudio()`:

```swift
func playAudio(artObjects: [BRCArtObject]) {
playAudioCalled = true
currentlyPlaying = artObjects.first

// Post notification synchronously for simpler testing
NotificationCenter.default.post(
name: Notification.Name(BRCAudioPlayer.BRCAudioPlayerChangeNotification),
object: nil
)
}
```

**Note**: Used synchronous posting (no `DispatchQueue.main.async`) for simpler test flow, as we're already on the main thread in tests.

### 2. Fixed Test Setup (`DetailViewModelTests.swift`)

Updated both audio tests to create a `DetailViewModel` with `artObjectWithAudio`:

```swift
func testCellTapAudioTogglesPlayback() {
let artObject = MockDataObjects.artObjectWithAudio

// Create a viewModel with the art object that has audio
let audioViewModel = DetailViewModel(
dataObject: artObject,
dataService: mockDataService,
audioService: mockAudioService,
locationService: mockLocationService,
coordinator: mockCoordinator
)

let audioCellType = DetailCellType.audio(artObject, isPlaying: false)
let audioCell = DetailCell(audioCellType)

audioViewModel.handleCellTap(audioCell)

XCTAssertTrue(mockAudioService.playAudioCalled)
XCTAssertTrue(audioViewModel.isAudioPlaying)
}
```

## Technical Details

### Files Modified

- `iBurn/Detail/Services/MockServices.swift`: Added notification posting to MockAudioService
- `iBurnTests/DetailViewModelTests.swift`: Fixed test setup for both audio toggle tests

### Notification Flow

1. User taps audio cell → `handleCellTap()` called
2. `handleCellTap()` calls `audioService.playAudio()`
3. Audio service posts `BRCAudioPlayerChangeNotification` (async on main queue in production, sync in tests)
4. `DetailViewModel` notification observer receives notification
5. `updateAudioPlayingState()` called, checks if `dataObject` has audio
6. Updates `isAudioPlaying` based on `audioService.isPlaying(artObject:)`

### Design Considerations

**Option 1 vs Option 2**: We chose Option 2 (synchronous notification posting in mock) over Option 1 (XCTestExpectation with async) because:
- Simpler test code - no need for expectations and waits
- Tests are already running on main thread
- Don't need to match threading behavior in unit tests
- Faster test execution

## Test Results

Both tests now pass:
- `testCellTapAudioTogglesPlayback` ✅
- `testCellTapAudioPausesWhenPlaying` ✅

## Commit

```
60a6389 Fix audio toggle tests by posting notification in MockAudioService
```
Loading
Loading