.
This commit is contained in:
+18
@@ -10,6 +10,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
@@ -153,4 +154,21 @@ class MarketingAnalysisServiceChartPlacementTest {
|
||||
assertTrue(section7Body.contains("[[CHART_CHANNEL_MATRIX]]"),
|
||||
"Must insert CHART_CHANNEL_MATRIX into section VII");
|
||||
}
|
||||
|
||||
@Test
|
||||
void buildChartJsonBlock_shouldStartWithJsonKey_andEndWithDoubleNewline() throws Exception {
|
||||
Method m = MarketingAnalysisService.class.getDeclaredMethod("buildChartJsonBlock", String.class, String.class);
|
||||
m.setAccessible(true);
|
||||
|
||||
String out = (String) m.invoke(marketingAnalysisService, "segmentsChannelMatrix", "{\"a\":1}");
|
||||
|
||||
assertTrue(out.startsWith("```json:segmentsChannelMatrix\n"),
|
||||
"Block must start strictly with ```json:<key> and newline");
|
||||
assertTrue(out.endsWith("\n```\n\n"), "Block must end with closing fence followed by two newlines");
|
||||
|
||||
// Ensure there is no whitespace before opening fence (strict parsing on
|
||||
// frontend)
|
||||
assertTrue(Pattern.compile("(?m)^```json:segmentsChannelMatrix$").matcher(out).find(),
|
||||
"Opening fence line must be exactly ```json:<key> with no leading spaces");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user