Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions apps/desktop-tauri/src/hooks/useTrayPanelLayout.sizing.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,20 @@ describe("useTrayPanelLayout sizing", () => {
tauriMocks.revealTrayPanelWindow.mock.calls.length;
expect(settledRevealCount - revealsBeforeSettle).toBeLessThanOrEqual(1);

await act(async () => {
await new Promise((resolve) => window.setTimeout(resolve, 500));
});
expect(tauriMocks.revealTrayPanelWindow.mock.calls.length).toBe(
settledRevealCount,
let lastRevealCount = settledRevealCount;
let stableSince = Date.now();
await waitFor(
() => {
const revealCount =
tauriMocks.revealTrayPanelWindow.mock.calls.length;
if (revealCount !== lastRevealCount) {
lastRevealCount = revealCount;
stableSince = Date.now();
}
expect(revealCount - revealsBeforeSettle).toBeLessThanOrEqual(1);
expect(Date.now() - stableSince).toBeGreaterThanOrEqual(500);
},
{ timeout: 3000, interval: 50 },
);
});

Expand Down
29 changes: 18 additions & 11 deletions rust/src/providers/claude/accounts/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,23 +582,30 @@ mod tests {
)
.unwrap();
std::fs::write(dir.path().join(".claude.json"), r#"{"oauthAccount":{"accountUuid":"test","organizationUuid":"org","emailAddress":"test@example.com"}}"#).unwrap();
// This test covers exit handling and credential isolation, not shell
// startup speed. Reap each fixture before starting the login deadline;
// cancelled_and_timed_out_logins_reap_child covers a running process.
let mut successful_child = child(dir.path(), false, 0);
assert!(successful_child.wait().unwrap().success());
let login = wait_for_login(
&mut child(dir.path(), false, 0),
&mut successful_child,
dir.path(),
&AtomicBool::new(false),
Duration::from_secs(10),
Duration::ZERO,
)
.unwrap();
assert_eq!(login.id().unwrap(), "test:org");
assert!(
wait_for_login(
&mut child(dir.path(), false, 1),
dir.path(),
&AtomicBool::new(false),
Duration::from_secs(10)
)
.is_err()
);
let mut failed_child = child(dir.path(), false, 1);
assert_eq!(failed_child.wait().unwrap().code(), Some(1));
let error = wait_for_login(
&mut failed_child,
dir.path(),
&AtomicBool::new(false),
Duration::ZERO,
)
.err()
.expect("a failed login process must be rejected");
assert!(error.to_string().contains("exit code 1"));
}

#[test]
Expand Down