/*
 * SPDX-License-Identifier: GPL-3.0-or-later
 */
package com.runicgateway.app.data.api.fake

import com.runicgateway.app.core.net.ShardStream
import com.runicgateway.app.core.net.ShardStreamEvent
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf

/**
 * A finite fake of the live [ShardStream] for board-ViewModel tests: it emits the
 * given [events] once and completes, so the ViewModel's `collectLive()` finishes
 * immediately (no perpetual reconnect loop) and any live-frame handling it triggers
 * is exercised deterministically.
 */
class FakeShardStream(private val events: List<ShardStreamEvent> = emptyList()) : ShardStream {
    override fun events(): Flow<ShardStreamEvent> = flowOf(*events.toTypedArray())
}
