Forráskód Böngészése

test(cockpit): verify detail and map page parity

Kazerin 3 hete
szülő
commit
6cab847d4e

+ 12 - 0
pipe-network-service/zksy-admin/src/test/java/com/zksy/web/controller/cockpit/BusinessCockpitMapSnapshotAdapterTest.java

@@ -11,6 +11,9 @@ import com.zksy.cockpit.map.BusinessCockpitMapSnapshotAdapter;
 import com.zksy.cockpit.map.CockpitMapSnapshot;
 import com.zksy.cockpit.map.CockpitMapSnapshotService;
 import com.zksy.cockpit.point.BusinessCockpitDeviceFactResolver;
+import com.zksy.cockpit.point.CockpitMonitoringPointDetailAdapter;
+import com.zksy.cockpit.point.CockpitMonitoringPointDetailService;
+import com.zksy.cockpit.point.CockpitMonitoringPointDeviceCard;
 import com.zksy.cockpit.point.CockpitMonitoringPointDeviceSnapshot;
 import com.zksy.framework.config.FastJson2JsonRedisSerializer;
 import org.junit.jupiter.api.BeforeEach;
@@ -264,9 +267,18 @@ class BusinessCockpitMapSnapshotAdapterTest {
                 .thenReturn(Collections.singletonList(firstDevice));
         var secondPage = service.load("req", 2, 1, snapshotAt, null, null, null);
 
+        CockpitMonitoringPointDetailService detailService = new CockpitMonitoringPointDetailService(
+                mock(CockpitMonitoringPointDetailAdapter.class), adapter,
+                Clock.fixed(Instant.parse("2026-09-02T02:00:00Z"), ZoneOffset.UTC));
+        var detail = detailService.load("req", "POINT-2", snapshotAt);
+
         assertEquals("POINT-2", secondPage.getMonitoringPoints().get(0).getPointCode());
         assertEquals(Collections.singletonList("DEVICE-2"),
                 secondPage.getMonitoringPoints().get(0).getDeviceCodes());
+        assertEquals(secondPage.getMonitoringPoints().get(0).getDeviceCodes(),
+                detail.getDevices().stream()
+                        .map(CockpitMonitoringPointDeviceCard::getDeviceCode)
+                        .collect(java.util.stream.Collectors.toList()));
     }
 
     @Test