Replace PathResourceResolver SPA fallback with SpaController that injects OG/Twitter meta-tags into cached index.html template. Event pages get event-specific tags (title, date, location), all other pages get generic fete branding. Includes og-image.png brand asset and forward-headers-strategy for proxy support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
39 lines
1.3 KiB
Java
39 lines
1.3 KiB
Java
package de.fete.config;
|
|
|
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
|
|
|
import de.fete.TestcontainersConfig;
|
|
import org.junit.jupiter.api.Test;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.context.annotation.Import;
|
|
import org.springframework.test.web.servlet.MockMvc;
|
|
|
|
@SpringBootTest
|
|
@AutoConfigureMockMvc
|
|
@Import(TestcontainersConfig.class)
|
|
class WebConfigTest {
|
|
|
|
@Autowired
|
|
private MockMvc mockMvc;
|
|
|
|
@Test
|
|
void actuatorHealthIsOutsideApiPrefix() throws Exception {
|
|
mockMvc.perform(get("/actuator/health"))
|
|
.andExpect(status().isOk())
|
|
.andExpect(jsonPath("$.status").value("UP"));
|
|
}
|
|
|
|
@Test
|
|
void apiPrefixNotAccessibleWithoutIt() throws Exception {
|
|
// /events without /api prefix should not resolve to the REST API endpoint;
|
|
// it is served by SpaController as HTML instead
|
|
mockMvc.perform(get("/events")
|
|
.accept("text/html"))
|
|
.andExpect(status().isOk());
|
|
}
|
|
}
|