Skip to content

Commit a27302c

Browse files
committed
test(limrun): pin the accept-once/second-get-none timeline and satisfy catch-name lint
Adds the maintainer's live-validated sequence at the unit seam: accept taps exactly once, and a following get on the same seam reports no alert. Renames catch params to satisfy oxlint's catch-error-name (three findings the affected gate reported).
1 parent afbddb3 commit a27302c

2 files changed

Lines changed: 23 additions & 9 deletions

File tree

‎packages/provider-limrun/src/alert.test.ts‎

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ describe('acting budgets', () => {
104104
it('refuses an ambiguous alert without tapping, on a typed reason', async () => {
105105
const client = clientWithTrees([limrunAlertAmbiguousButtonsTree()]);
106106

107-
const error = await handleLimrunIosAlert(client, 'accept').then(
107+
const thrown = await handleLimrunIosAlert(client, 'accept').then(
108108
() => undefined,
109-
(caught: unknown) => caught,
109+
(error: unknown) => error,
110110
);
111-
expect(error).toBeInstanceOf(AppError);
112-
const refusal = error as AppError;
111+
expect(thrown).toBeInstanceOf(AppError);
112+
const refusal = thrown as AppError;
113113
expect(refusal.code).toBe('COMMAND_FAILED');
114114
expect(refusal.details?.reason).toBe(ALERT_BUTTON_UNDECIDED_REASON);
115115
expect(refusal.details?.dispatched).toBe('no');
@@ -150,15 +150,29 @@ describe('acting budgets', () => {
150150
expect(result.kind === 'alertHandled' && result.button).toBe('Allow');
151151
});
152152

153+
it('taps exactly once on accept, and the next get reports no alert', async () => {
154+
// The maintainer's live-validated timeline at the unit seam: one tap for the action, the
155+
// post-tap confirm observes the app screen, and a following read sees that same absence.
156+
const client = clientWithTrees([limrunAttAlertTree(), limrunAppScreenTree()]);
157+
158+
const handled = await handleLimrunIosAlert(client, 'accept');
159+
expect(handled.kind).toBe('alertHandled');
160+
expect(client.tap).toHaveBeenCalledTimes(1);
161+
162+
const status = await handleLimrunIosAlert(client, 'get');
163+
expect(status.kind === 'alertStatus' && status.alert).toBeNull();
164+
expect(status.kind === 'alertStatus' && status.message).toBe('No alert visible');
165+
});
166+
153167
it('refuses to act on an alert-shaped but unresolvable capture, without tapping', async () => {
154168
const client = clientWithTrees([limrunAlertTreeWithUnpressableButtons()]);
155169

156-
const error = await underFakeTimers(() => handleLimrunIosAlert(client, 'accept')).then(
170+
const thrown = await underFakeTimers(() => handleLimrunIosAlert(client, 'accept')).then(
157171
() => undefined,
158-
(caught: unknown) => caught,
172+
(error: unknown) => error,
159173
);
160-
expect(error).toBeInstanceOf(AppError);
161-
const refusal = error as AppError;
174+
expect(thrown).toBeInstanceOf(AppError);
175+
const refusal = thrown as AppError;
162176
expect(refusal.code).toBe('COMMAND_FAILED');
163177
expect(refusal.details?.reason).toBe(ALERT_CAPTURE_UNDECIDED_REASON);
164178
expect(refusal.details?.dispatched).toBe('no');

‎packages/provider-limrun/src/ios-interactor-alert.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ describe('acceptAlert', () => {
121121

122122
const error = await interactor.acceptAlert!().then(
123123
() => undefined,
124-
(caught: unknown) => caught,
124+
(error: unknown) => error,
125125
);
126126
expect(error).toBeInstanceOf(AppError);
127127
const refusal = error as AppError;

0 commit comments

Comments
 (0)