feat(cli): implement atomic writes and safety checks for trusted folders (#18406)

This commit is contained in:
Gal Zahavi
2026-02-09 09:16:56 -08:00
committed by GitHub
parent 01906a9205
commit 81ccd80c6d
16 changed files with 549 additions and 971 deletions
@@ -149,7 +149,9 @@ describe('useFolderTrust', () => {
});
await act(async () => {
result.current.handleFolderTrustSelect(FolderTrustChoice.TRUST_FOLDER);
await result.current.handleFolderTrustSelect(
FolderTrustChoice.TRUST_FOLDER,
);
});
await waitFor(() => {
@@ -173,7 +175,9 @@ describe('useFolderTrust', () => {
);
await act(async () => {
result.current.handleFolderTrustSelect(FolderTrustChoice.TRUST_PARENT);
await result.current.handleFolderTrustSelect(
FolderTrustChoice.TRUST_PARENT,
);
});
await waitFor(() => {
@@ -197,7 +201,9 @@ describe('useFolderTrust', () => {
);
await act(async () => {
result.current.handleFolderTrustSelect(FolderTrustChoice.DO_NOT_TRUST);
await result.current.handleFolderTrustSelect(
FolderTrustChoice.DO_NOT_TRUST,
);
});
await waitFor(() => {
@@ -221,7 +227,7 @@ describe('useFolderTrust', () => {
);
await act(async () => {
result.current.handleFolderTrustSelect(
await result.current.handleFolderTrustSelect(
'invalid_choice' as FolderTrustChoice,
);
});
@@ -253,7 +259,9 @@ describe('useFolderTrust', () => {
});
await act(async () => {
result.current.handleFolderTrustSelect(FolderTrustChoice.TRUST_FOLDER);
await result.current.handleFolderTrustSelect(
FolderTrustChoice.TRUST_FOLDER,
);
});
await waitFor(() => {
@@ -272,7 +280,9 @@ describe('useFolderTrust', () => {
);
await act(async () => {
result.current.handleFolderTrustSelect(FolderTrustChoice.TRUST_FOLDER);
await result.current.handleFolderTrustSelect(
FolderTrustChoice.TRUST_FOLDER,
);
});
await waitFor(() => {
@@ -294,8 +304,10 @@ describe('useFolderTrust', () => {
useFolderTrust(mockSettings, onTrustChange, addItem),
);
act(() => {
result.current.handleFolderTrustSelect(FolderTrustChoice.TRUST_FOLDER);
await act(async () => {
await result.current.handleFolderTrustSelect(
FolderTrustChoice.TRUST_FOLDER,
);
});
await vi.runAllTimersAsync();