test(restapi): drop /swagger-ui from 404 test (env-dependent)
Failed pipeline 6805: /swagger-ui/index.html в test profile вернул 200 (springdoc enabled по умолчанию через ORDINIS_SWAGGER_UI_ENABLED default true). Это валидно — Swagger render'ит реальную UI page. Замена: проверяем generic non-API typo path который точно не имеет controller'а и не SPA-route'д. Покрывает тот же NoResourceFoundException branch handler'а независимо от springdoc env config.
This commit is contained in:
@@ -141,8 +141,9 @@ class SmokeE2ETest {
|
||||
* debugging без traceId correlation.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>Покрывает оба пути: путь похожий на API ({@code /api/v1/notexist}) и
|
||||
* generic non-API ({@code /random/path}).
|
||||
* <p>Тест проверяет API-typo путь — он независим от env (springdoc может
|
||||
* быть enabled/disabled, не влияет). Проверка swagger-ui→404 при disabled
|
||||
* springdoc относится к prod integration, не к unit-уровню handler'а.
|
||||
*/
|
||||
@Test
|
||||
void unknownPath_returns404WithNotFoundCode() throws Exception {
|
||||
@@ -151,7 +152,9 @@ class SmokeE2ETest {
|
||||
.andExpect(jsonPath("$.status").value(404))
|
||||
.andExpect(jsonPath("$.code").value("not_found"));
|
||||
|
||||
mvc.perform(get("/swagger-ui/index.html"))
|
||||
// Generic non-API typo тоже должен 404'нуться (covers static resource
|
||||
// fallback branch NoResourceFoundException — этот путь не SPA-routed).
|
||||
mvc.perform(get("/totally-bogus-path-xyz-12345.unknown"))
|
||||
.andExpect(status().isNotFound())
|
||||
.andExpect(jsonPath("$.status").value(404))
|
||||
.andExpect(jsonPath("$.code").value("not_found"));
|
||||
|
||||
Reference in New Issue
Block a user