알림문제 수정

This commit is contained in:
Macbook
2026-05-28 01:45:53 +09:00
parent aace2282d5
commit 01218b99c9
6 changed files with 180 additions and 31 deletions
@@ -4,6 +4,8 @@ import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import java.util.Set;
import static org.junit.jupiter.api.Assertions.*;
class StrategyDslTimeframeNormalizerTest {
@@ -49,6 +51,50 @@ class StrategyDslTimeframeNormalizerTest {
assertEquals("3m", root.path("candleType").asText());
}
@Test
void normalize_dropsStale1mWhenConditionsUse5mOnly() throws Exception {
String json = """
{
"type": "TIMEFRAME",
"candleType": "1m",
"candleTypes": ["1m", "5m"],
"children": [{
"type": "CONDITION",
"condition": {
"indicatorType": "CCI",
"leftCandleType": "5m",
"rightCandleType": "5m"
}
}]
}
""";
String normalized = normalizer.normalizeJson(json, "알트레이어 매수 알림");
JsonNode root = objectMapper.readTree(normalized);
assertEquals(1, root.path("candleTypes").size());
assertEquals("5m", root.path("candleTypes").get(0).asText());
assertEquals("5m", root.path("candleType").asText());
}
@Test
void resolveStartCandleTypes_dropsStale1mPair() throws Exception {
String json = """
{
"type": "TIMEFRAME",
"candleType": "1m",
"candleTypes": ["1m", "5m"],
"children": [{
"type": "CONDITION",
"condition": {
"indicatorType": "CCI",
"leftCandleType": "5m"
}
}]
}
""";
JsonNode root = objectMapper.readTree(json);
assertEquals(Set.of("5m"), StrategyDslTimeframeNormalizer.resolveStartCandleTypes(root));
}
@Test
void normalize_preservesMultiCandleTypesOnSave() throws Exception {
String json = """