Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Dec 7, 2024
1 parent 3f043f9 commit 0012019
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions music/player/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies {
implementation(libs.ktor.client.logging)

testImplementation(kotlin("test-junit5"))
testImplementation(libs.stdx.full)
}

kotlin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class MusicPlayer(val link: Link, private val guild: GuildBehavior) : Link by li
private val lock = Mutex()

var djModeRole: Snowflake? = null
var queue = Queue(musicPlayer = this)
var queue = Queue(_musicPlayer = this)
val queuedTracks get() = queue.tracks
val canSkip: Boolean
get() = queuedTracks.isNotEmpty() || !autoPlay?.songs.isNullOrEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.asSharedFlow
import java.util.*

class Queue(private var tracksList: MutableList<QueuedTrack> = mutableListOf(), val musicPlayer: MusicPlayer) {
class Queue(
private var tracksList: MutableList<QueuedTrack> = mutableListOf(),
private val _musicPlayer: MusicPlayer? = null,
) {
val musicPlayer: MusicPlayer
get() = _musicPlayer ?: error("This queue is a mock")
var shuffle: Boolean = false
set(value) {
if (field == value) return
Expand Down
2 changes: 1 addition & 1 deletion music/player/src/test/kotlin/QueueTest.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import dev.arbjerg.lavalink.protocol.v4.Track
import dev.arbjerg.lavalink.protocol.v4.TrackInfo
import dev.kord.common.entity.Snowflake
import dev.schlaubi.mikmusic.api.types.SimpleQueuedTrack
import dev.schlaubi.mikmusic.player.Queue
import dev.schlaubi.mikmusic.player.SimpleQueuedTrack
import dev.schlaubi.stdx.serialization.emptyJsonObject
import kotlin.test.Test
import kotlin.test.assertEquals
Expand Down

0 comments on commit 0012019

Please sign in to comment.