전략편집기 수정, 보조지표 설정 수정
This commit is contained in:
@@ -11,6 +11,44 @@ class StrategyDslTimeframeNormalizerTest {
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
private final StrategyDslTimeframeNormalizer normalizer = new StrategyDslTimeframeNormalizer(objectMapper);
|
||||
|
||||
@Test
|
||||
void normalize_preserves3mAnd5mWithout1m() throws Exception {
|
||||
String json = """
|
||||
{
|
||||
"type": "TIMEFRAME",
|
||||
"candleType": "1m",
|
||||
"candleTypes": ["3m", "5m"],
|
||||
"children": [{
|
||||
"type": "CONDITION",
|
||||
"condition": { "indicatorType": "RSI", "period": 14 }
|
||||
}]
|
||||
}
|
||||
""";
|
||||
String normalized = normalizer.normalizeJson(json, "테스트");
|
||||
JsonNode root = objectMapper.readTree(normalized);
|
||||
assertEquals(2, root.path("candleTypes").size());
|
||||
assertEquals("3m", root.path("candleTypes").get(0).asText());
|
||||
assertEquals("5m", root.path("candleTypes").get(1).asText());
|
||||
assertEquals("3m", root.path("candleType").asText());
|
||||
}
|
||||
|
||||
@Test
|
||||
void normalize_preservesSingleExplicit3m() throws Exception {
|
||||
String json = """
|
||||
{
|
||||
"type": "TIMEFRAME",
|
||||
"candleType": "3m",
|
||||
"children": [{
|
||||
"type": "CONDITION",
|
||||
"condition": { "indicatorType": "RSI", "period": 14 }
|
||||
}]
|
||||
}
|
||||
""";
|
||||
String normalized = normalizer.normalizeJson(json, "테스트");
|
||||
JsonNode root = objectMapper.readTree(normalized);
|
||||
assertEquals("3m", root.path("candleType").asText());
|
||||
}
|
||||
|
||||
@Test
|
||||
void normalize_preservesMultiCandleTypesOnSave() throws Exception {
|
||||
String json = """
|
||||
|
||||
Reference in New Issue
Block a user