feat(commands): unify settings and admin commands
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package games.dmg.spigotbase;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
import java.io.InputStream;
|
||||
@@ -10,6 +11,34 @@ import org.junit.jupiter.api.Test;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
final class PluginMetadataTest {
|
||||
@Test
|
||||
void homeadminAliasesBaseadmin() {
|
||||
Map<?, ?> commands = commands();
|
||||
|
||||
Map<?, ?> admin = (Map<?, ?>) commands.get("baseadmin");
|
||||
assertEquals(List.of("homeadmin"), admin.get("aliases"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void doesNotDeclareSupersededSettingsCommands() {
|
||||
Map<?, ?> commands = commands();
|
||||
|
||||
for (String command : List.of(
|
||||
"baseprogress", "basenavigation", "baseflight", "basevisitors"
|
||||
)) {
|
||||
assertFalse(commands.containsKey(command), command);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void homesettingsAliasesBasesettings() {
|
||||
Map<?, ?> commands = commands();
|
||||
|
||||
Map<?, ?> settings = (Map<?, ?>) commands.get("basesettings");
|
||||
assertNotNull(settings);
|
||||
assertEquals(List.of("homesettings"), settings.get("aliases"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void sethomeAliasesSetbase() {
|
||||
Map<?, ?> commands = commands();
|
||||
@@ -26,30 +55,6 @@ final class PluginMetadataTest {
|
||||
assertEquals(List.of("home"), base.get("aliases"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void homevisitorsAliasesBasevisitors() {
|
||||
Map<?, ?> commands = commands();
|
||||
|
||||
Map<?, ?> visitors = (Map<?, ?>) commands.get("basevisitors");
|
||||
assertEquals(List.of("homevisitors"), visitors.get("aliases"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void homeflightAliasesBaseflight() {
|
||||
Map<?, ?> commands = commands();
|
||||
|
||||
Map<?, ?> flight = (Map<?, ?>) commands.get("baseflight");
|
||||
assertEquals(List.of("homeflight"), flight.get("aliases"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void homenavigationAliasesBasenavigation() {
|
||||
Map<?, ?> commands = commands();
|
||||
|
||||
Map<?, ?> navigation = (Map<?, ?>) commands.get("basenavigation");
|
||||
assertEquals(List.of("homenavigation"), navigation.get("aliases"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void visitAliasesGotobase() {
|
||||
Map<?, ?> commands = commands();
|
||||
@@ -70,8 +75,7 @@ final class PluginMetadataTest {
|
||||
|
||||
Map<?, ?> commands = (Map<?, ?>) plugin.get("commands");
|
||||
for (String command : new String[] {
|
||||
"setbase", "base", "basenavigation", "baseflight",
|
||||
"basevisitors", "gotobase", "baseprogress", "baseadmin"
|
||||
"setbase", "base", "gotobase", "basesettings", "baseadmin"
|
||||
}) {
|
||||
assertNotNull(commands.get(command), command);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user