//! Fixtures and audio-transport doubles compiled only by the test harness. use crate::{ model::Song, player::{Playback, PlayerEvent}, }; pub fn songs() -> Vec { (0..8) .map(|index| Song { id: format!("track-{index}"), title: format!("Track {index}"), artist: "Test artist".into(), album: "Test album".into(), duration: 240, is_external: index >= 4, octo_suggested_by: (index >= 4).then(|| "Last.fm".into()), ..Default::default() }) .collect() } #[derive(Default)] pub struct TestPlayback { pub events: std::sync::Arc>>, pub commands: std::sync::Arc>>, } impl Playback for TestPlayback { fn command(&mut self, command: serde_json::Value) -> anyhow::Result<()> { self.commands.lock().unwrap().push(command); Ok(()) } fn drain_events(&self) -> Vec { self.events.lock().unwrap().drain(..).collect() } }