1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-25 22:53:22 +00:00
CC-Tweaked/src/test/java/dan200/computercraft/ingame/DiskDriveTest.kt
Jonathan Coates eaa7359c8c Add a whole bunch of tests
Coverage graph goes woosh. Hopefully.

More importantly, all of these are historic regressions, so very much
worth tracking.
2021-01-19 20:02:45 +00:00

28 lines
880 B
Kotlin

package dan200.computercraft.ingame
import dan200.computercraft.ingame.api.*
import net.minecraft.entity.item.ItemEntity
import net.minecraft.item.Items
import net.minecraft.util.math.BlockPos
import org.junit.jupiter.api.Assertions.assertEquals
class DiskDriveTest {
/**
* Ensure audio disks exist and we can play them.
*
* @see [#688](https://github.com/SquidDev-CC/CC-Tweaked/issues/688)
*/
@GameTest
suspend fun `Audio disk`(context: TestContext) = context.checkComputerOk(3)
@GameTest
suspend fun `Ejects disk`(context: TestContext) {
val stackAt = BlockPos(2, 0, 2)
context.checkComputerOk(4)
context.waitUntil { context.getEntity(stackAt) != null }
val stack = context.getEntityOfType<ItemEntity>(stackAt)!!
assertEquals(Items.MUSIC_DISC_13, stack.item.item, "Correct item stack")
}
}