feat(commands): add base command aliases
This commit is contained in:
@@ -4,11 +4,36 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
final class PluginMetadataTest {
|
||||
@Test
|
||||
void sethomeAliasesSetbase() {
|
||||
Map<?, ?> commands = commands();
|
||||
|
||||
Map<?, ?> setbase = (Map<?, ?>) commands.get("setbase");
|
||||
assertEquals(List.of("sethome"), setbase.get("aliases"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void homeAliasesBase() {
|
||||
Map<?, ?> commands = commands();
|
||||
|
||||
Map<?, ?> base = (Map<?, ?>) commands.get("base");
|
||||
assertEquals(List.of("home"), base.get("aliases"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void visitAliasesGotobase() {
|
||||
Map<?, ?> commands = commands();
|
||||
|
||||
Map<?, ?> gotobase = (Map<?, ?>) commands.get("gotobase");
|
||||
assertEquals(List.of("visit"), gotobase.get("aliases"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void declaresPluginEntrypointCommandsAndPermissions() {
|
||||
InputStream stream = getClass().getClassLoader().getResourceAsStream("plugin.yml");
|
||||
@@ -30,4 +55,11 @@ final class PluginMetadataTest {
|
||||
Map<?, ?> permissions = (Map<?, ?>) plugin.get("permissions");
|
||||
assertNotNull(permissions.get("spigotbase.admin"));
|
||||
}
|
||||
|
||||
private Map<?, ?> commands() {
|
||||
InputStream stream = getClass().getClassLoader().getResourceAsStream("plugin.yml");
|
||||
assertNotNull(stream);
|
||||
Map<?, ?> plugin = new Yaml().load(stream);
|
||||
return (Map<?, ?>) plugin.get("commands");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user