feat: Add hardened error handling and retries (#2451)
- Closes #1830 - Closes #2099
This commit is contained in:
committed by
dermotduffy
parent
4bc787e2b7
commit
47bcce93d3
@@ -0,0 +1,25 @@
|
||||
// @vitest-environment jsdom
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { createRetryControl } from '../../../src/card-controller/issues/retry-control';
|
||||
import { InternalCallbackActionConfig } from '../../../src/config/schema/actions/custom/internal';
|
||||
import { createCardAPI } from '../../test-utils';
|
||||
|
||||
describe('createRetryControl', () => {
|
||||
it('should return a control with expected icon, tooltip, and dismiss', () => {
|
||||
const control = createRetryControl('media_load');
|
||||
|
||||
expect(control.icon).toBe('mdi:refresh');
|
||||
expect(control.tooltip).toBe('Retry');
|
||||
expect(control.dismiss).toBe(true);
|
||||
});
|
||||
|
||||
it('should call manager.retry with the issue key when the callback executes', async () => {
|
||||
const api = createCardAPI();
|
||||
const control = createRetryControl('media_query');
|
||||
|
||||
const tapAction = control.actions?.tap_action as InternalCallbackActionConfig;
|
||||
await tapAction.callback(api);
|
||||
|
||||
expect(api.getIssueManager().retry).toBeCalledWith('media_query', true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user