Skip to content

Commit 1e96a64

Browse files
committed
Add test for Beacons in the Minecraft Mod (lol) Integration
1 parent 970fc5f commit 1e96a64

File tree

3 files changed

+746
-0
lines changed

3 files changed

+746
-0
lines changed

src/testMod/kotlin/de/srendi/advancedperipherals/test/ModIntegrTest.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,9 @@ class ModIntegrTest {
2424
thenComputerOk();
2525
}
2626

27+
@GameTest(timeoutTicks = 300)
28+
fun minecraftBeacon(context: GameTestHelper) = context.sequence {
29+
thenComputerOk();
30+
}
31+
2732
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
--- Advanced Peripherals tests for the Minecraft integration on Beacons
3+
--- Covers `getLevel`, `getPrimaryEffect`, `getSecondaryEffect`
4+
---
5+
6+
-- Wait until the beacon structure is formed
7+
sleep(4)
8+
9+
-- Test left beacon, level 4, primary and secondary effect set to haste
10+
test.eq("beacon", peripheral.getType("left"), "Peripheral should be beacon")
11+
beacon = peripheral.wrap("left")
12+
test.assert(beacon, "Peripheral not found")
13+
14+
test.eq(4, beacon.getLevel(), "Level should be 4")
15+
test.eq("effect.minecraft.haste", beacon.getPrimaryEffect(), "Primary effect should be haste")
16+
test.eq("effect.minecraft.haste", beacon.getSecondaryEffect(), "Secondary effect should be haste")
17+
18+
-- Test right beacon, level 4, primary effect set to speed, secondary effect not set
19+
test.eq("beacon", peripheral.getType("right"), "Peripheral should be beacon")
20+
beacon = peripheral.wrap("right")
21+
test.assert(beacon, "Peripheral not found")
22+
23+
test.eq(4, beacon.getLevel(), "Level should be 4")
24+
test.eq("effect.minecraft.speed", beacon.getPrimaryEffect(), "Primary effect should be haste")
25+
test.eq("none", beacon.getSecondaryEffect(), "Secondary effect should be none")
26+
27+
-- Test top beacon, level 0, primary and secondary effect not set
28+
test.eq("beacon", peripheral.getType("top"), "Peripheral should be beacon")
29+
beacon = peripheral.wrap("top")
30+
test.assert(beacon, "Peripheral not found")
31+
32+
test.eq(0, beacon.getLevel(), "Level should be 0")
33+
test.eq("none", beacon.getPrimaryEffect(), "Primary effect should be none")
34+
test.eq("none", beacon.getSecondaryEffect(), "Secondary effect should be none")

0 commit comments

Comments
 (0)