mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
Expect no minItems on the options that default to an empty list
The schema tests pinned minItems on options whose @MinItems is gone. Only the decorator palette is asserted to keep it.
This commit is contained in:
1 parent
7bef5dbfd4
commit
cff15f93c5
2 files changed
+11
-10
No files matched your search
@@ -186,13 +186,13 @@ public class BuiltInGenerationGraphTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void depositGeneratorsKeepTheMinimumListLengthsTheOldClassHad() throws IOException {
|
||||
public void depositGeneratorListsDeclareNoMinimumLength() throws IOException {
|
||||
try (LoadedPack pack = BuiltInPack.serve(mock(IrisData.class), folder, List.of())) {
|
||||
ObjectType generator = pack.schema().type(DepositGenerator.class.getName());
|
||||
|
||||
for (String list : List.of("palette", "replaceableBlocks", "includedBiomes", "excludedBiomes")) {
|
||||
SchemaOption option = generator.options().stream().filter(candidate -> candidate.name().equals(list)).findFirst().orElseThrow();
|
||||
assertEquals(list, OptionalInt.of(1), option.minItems());
|
||||
assertEquals(list, OptionalInt.empty(), option.minItems());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,18 +213,19 @@ public class BuiltInGenerationGraphTest {
|
||||
assertEquals("decorators", option.name());
|
||||
assertEquals("decorators are a module class of IrisApi types, not an Iris class",
|
||||
new ValueKind.ListKind(new ValueKind.ObjectKind(Decorator.class.getName()), false), option.kind());
|
||||
assertEquals(OptionalInt.of(1), option.minItems());
|
||||
assertEquals(OptionalInt.empty(), option.minItems());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void decoratorsKeepTheMinimumListLengthsTheOldClassHad() throws IOException {
|
||||
public void onlyTheDecoratorPaletteNeedsAnEntry() throws IOException {
|
||||
try (LoadedPack pack = BuiltInPack.serve(mock(IrisData.class), folder, List.of())) {
|
||||
ObjectType decorator = pack.schema().type(Decorator.class.getName());
|
||||
|
||||
for (String list : List.of("whitelist", "blacklist", "palette", "topPalette")) {
|
||||
SchemaOption option = decorator.options().stream().filter(candidate -> candidate.name().equals(list)).findFirst().orElseThrow();
|
||||
assertEquals(list, OptionalInt.of(1), option.minItems());
|
||||
OptionalInt expected = list.equals("palette") ? OptionalInt.of(1) : OptionalInt.empty();
|
||||
assertEquals(list, expected, option.minItems());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ public class SchemaBuilderParityTest {
|
||||
JSONObject decorators = properties.getJSONObject("decorators");
|
||||
assertEquals("array", deposits.getString("type"));
|
||||
assertEquals("array", decorators.getString("type"));
|
||||
assertEquals(1, decorators.getInt("minItems"));
|
||||
assertFalse(decorators.has("minItems"));
|
||||
assertEquals("module-art-arcane-iris-modules-deposit-depositgenerator", definitionKey(deposits.getJSONObject("items")));
|
||||
assertEquals("module-art-arcane-iris-builtin-decorant-decorator", definitionKey(decorators.getJSONObject("items")));
|
||||
for (JSONObject rooted : List.of(deposits, decorators)) {
|
||||
@@ -296,11 +296,11 @@ public class SchemaBuilderParityTest {
|
||||
.getJSONObject("properties");
|
||||
|
||||
assertEquals("boolean", settings.getJSONObject("enabled").getString("type"));
|
||||
assertEquals(1, settings.getJSONObject("disabled").getInt("minItems"));
|
||||
assertFalse(settings.getJSONObject("disabled").has("minItems"));
|
||||
for (String field : List.of("steps", "disabledSteps")) {
|
||||
JSONObject items = settings.getJSONObject(field).getJSONObject("items");
|
||||
JSONObject steps = items.has("$ref") ? definitions.getJSONObject(definitionKey(items)) : items;
|
||||
assertEquals(1, settings.getJSONObject(field).getInt("minItems"));
|
||||
assertFalse(settings.getJSONObject(field).has("minItems"));
|
||||
assertEquals(Arrays.stream(DecorationStep.values()).map(step -> "\"" + step.name() + "\"").collect(Collectors.joining(",")),
|
||||
steps.getJSONArray("enum").join(","));
|
||||
JSONArray descriptions = steps.getJSONArray("enumDescriptions");
|
||||
@@ -333,7 +333,7 @@ public class SchemaBuilderParityTest {
|
||||
assertTrue(terrain.has("lobeFrequency"));
|
||||
assertTrue(terrain.has("lobeStrength"));
|
||||
assertTrue(terrain.has("encasePalette"));
|
||||
assertEquals(1, settings.getJSONObject("adjustments").getInt("minItems"));
|
||||
assertFalse(settings.getJSONObject("adjustments").has("minItems"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -413,7 +413,7 @@ public class SchemaBuilderParityTest {
|
||||
JSONObject edit = properties.getJSONObject("edit");
|
||||
JSONObject replace = definitions.getJSONObject(definitionKey(edit.getJSONObject("items")));
|
||||
assertEquals("module-art-arcane-iris-builtin-blocks-objectreplace", definitionKey(edit.getJSONObject("items")));
|
||||
assertEquals(1, replace.getJSONArray("anyOf").getJSONObject(0).getJSONObject("properties").getJSONObject("find").getInt("minItems"));
|
||||
assertFalse(replace.getJSONArray("anyOf").getJSONObject(0).getJSONObject("properties").getJSONObject("find").has("minItems"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user