From 0700777e2f6b24008936643cfa22547d3173e23e Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Sat, 6 Jun 2026 12:37:21 -0400 Subject: [PATCH] test(e2e): guard ApiSurfaceFixture partial-init delete + seal TransportImportTests (final review nits) --- .../Admin/ApiSurfaceFixture.cs | 7 ++++++- .../Transport/TransportImportTests.cs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Admin/ApiSurfaceFixture.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Admin/ApiSurfaceFixture.cs index c6e291be..813bfb0b 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Admin/ApiSurfaceFixture.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Admin/ApiSurfaceFixture.cs @@ -28,7 +28,12 @@ public sealed class ApiSurfaceFixture : IAsyncLifetime } catch { - await CliRunner.DeleteApiMethodAsync(MethodId); + // Partial-init guard: MethodId is non-zero only if CreateApiMethodAsync succeeded, + // so skip the delete when nothing was created (avoids a phantom delete --id 0). + if (MethodId != 0) + { + await CliRunner.DeleteApiMethodAsync(MethodId); + } Available = false; throw; } diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Transport/TransportImportTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Transport/TransportImportTests.cs index 1b3eb7cb..57950e85 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Transport/TransportImportTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Transport/TransportImportTests.cs @@ -35,7 +35,7 @@ namespace ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests.Transport; /// /// [Collection("Playwright")] -public class TransportImportTests +public sealed class TransportImportTests { private readonly PlaywrightFixture _fixture;