From 7c9d688a825a5b8eb754cb0e9feccedb9d7ac0ed Mon Sep 17 00:00:00 2001 From: creatixchu Date: Tue, 28 Jul 2026 22:37:19 +0800 Subject: [PATCH] test(host): cover the native flow's re-arm guard A fresh injected face while the same request is open re-fires the effect; the armed guard must not relaunch the chooser (the uncovered branch CI's per-file gate flagged). --- .../host/directory-picker-native/tests/client-flow.spec.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/host/directory-picker-native/tests/client-flow.spec.tsx b/packages/host/directory-picker-native/tests/client-flow.spec.tsx index cf2cb96679..fe4c30fc5d 100644 --- a/packages/host/directory-picker-native/tests/client-flow.spec.tsx +++ b/packages/host/directory-picker-native/tests/client-flow.spec.tsx @@ -83,6 +83,11 @@ describe('directory-picker-native client half', () => { const second = owner() view.rerender() expect(pick).toHaveBeenCalledOnce() + // Even a fresh injected face (re-registration re-runs the inject factory) + // must not relaunch while the same request is still open. + const replacedPick = vi.fn(() => new Promise(() => {})) + view.rerender() + expect(replacedPick).not.toHaveBeenCalled() await act(async () => { resolve('/tmp/project') }) expect(second.onPicked).toHaveBeenCalledWith('/tmp/project') expect(first.onPicked).not.toHaveBeenCalled()