48 lines
1.5 KiB
Java
48 lines
1.5 KiB
Java
package games.dmg.spigotbase;
|
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
import java.util.Map;
|
|
import java.util.UUID;
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
final class AdminProgressCounterTest {
|
|
private final AdminProgressionService service = new AdminProgressionService(
|
|
new PluginSettingsProvider(PluginSettings.from(Map.of()))
|
|
);
|
|
|
|
@Test
|
|
void settingTotalPlacementCounterUnlocksSpawnableOverlay() {
|
|
PlayerState player = PlayerState.newPlayer(UUID.randomUUID(), "Alex");
|
|
|
|
PlayerState updated = service.setProgress(
|
|
player,
|
|
ProgressCounter.TOTAL_PLACEMENTS,
|
|
250
|
|
);
|
|
|
|
assertEquals(250, updated.totalBlocksPlaced());
|
|
}
|
|
|
|
@Test
|
|
void settingPlacementCounterEvaluatesBaseAndWarmupTiers() {
|
|
PlayerState player = PlayerState.newPlayer(UUID.randomUUID(), "Alex");
|
|
|
|
PlayerState updated = service.setProgress(player, ProgressCounter.PLACEMENTS, 2_000);
|
|
|
|
assertEquals(3, updated.baseLevel());
|
|
assertEquals(2, updated.warmupLevel());
|
|
assertEquals(2_000, updated.blocksPlacedInBase());
|
|
}
|
|
|
|
@Test
|
|
void settingBaseBreakCounterEvaluatesCooldownTier() {
|
|
PlayerState player = PlayerState.newPlayer(UUID.randomUUID(), "Alex");
|
|
|
|
PlayerState updated = service.setProgress(player, ProgressCounter.BASE_BREAKS, 5_000);
|
|
|
|
assertEquals(3, updated.baseLevel());
|
|
assertEquals(4, updated.cooldownLevel());
|
|
}
|
|
}
|