Files
goldenChart/backend/src/test/java/com/goldenchart/service/StrategyDslTimeframeNormalizerAlignTest.java
T
2026-05-28 01:26:53 +09:00

35 lines
1.1 KiB
Java

package com.goldenchart.service;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
class StrategyDslTimeframeNormalizerAlignTest {
private final StrategyDslTimeframeNormalizer normalizer =
new StrategyDslTimeframeNormalizer(new ObjectMapper());
@Test
void alignSell_copiesBuyCandleTypesToSell() throws Exception {
String buy = """
{
"type": "TIMEFRAME",
"candleType": "5m",
"candleTypes": ["5m"],
"children": [{ "type": "CONDITION", "condition": { "indicatorType": "RSI" } }]
}
""";
String sell = """
{
"type": "TIMEFRAME",
"candleType": "1m",
"children": [{ "type": "CONDITION", "condition": { "indicatorType": "RSI" } }]
}
""";
String aligned = normalizer.alignSellStartTimeframeToBuy(buy, sell);
assertTrue(aligned.contains("\"5m\""));
assertFalse(aligned.contains("\"candleType\":\"1m\""));
}
}