Skip to content

Commit

Permalink
Update Scheduling e2eTest to isolate compared region to exported Reso…
Browse files Browse the repository at this point in the history
…urce type
  • Loading branch information
Mythicaeda committed Nov 16, 2023
1 parent e6b57e7 commit 63cf8d4
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions e2e-tests/src/test/java/gov/nasa/jpl/aerie/e2e/SchedulingTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import javax.json.JsonObject;
import javax.json.JsonValue;
import java.io.IOException;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

Expand Down Expand Up @@ -671,21 +672,28 @@ void schedulingDSLGeneratesExternalTypes() throws IOException {
.toList();
assertEquals(1, findFile.size());

final var resources = """
export type Resource = {
"/peel": number,
"/my_boolean": boolean,
"/fruit": {initial: number, rate: number, },
"/data/line_count": number,
"/flag/conflicted": boolean,
"/plant": number,
"/flag": ( | "A" | "B"),
"/producer": string,
};
""";
for(final var resourcesLine: resources.split("\n")){
assertTrue(findFile.get(0).content().contains(resourcesLine));
}
// Create a list of the exported resource types, one entry per new line
final List<String> resourceTypes = Arrays.stream(findFile.get(0)
.content()
.split("export type Resource = \\{\\n")[1]
.split("\\n};")[0] // isolate to export type Resource block
.split("\\n"))
.map(String::strip) // remove whitespace
.toList();

final var expectedResources = List.of(
"\"/data/line_count\": number,",
"\"/flag\": ( | \"A\" | \"B\"),",
"\"/flag/conflicted\": boolean,",
"\"/fruit\": {initial: number, rate: number, },",
"\"/my_boolean\": boolean,",
"\"/peel\": number,",
"\"/plant\": number,",
"\"/producer\": string,"
);

assertEquals(expectedResources.size(), resourceTypes.size());
assertTrue(resourceTypes.containsAll(expectedResources));
}

/**
Expand Down

0 comments on commit 63cf8d4

Please sign in to comment.