Skip to content

Commit 29015d2

Browse files
committed
feat(auth): account scopes and expired pat workflow
Signed-off-by: Adam Setch <adam.setch@outlook.com>
1 parent 18b030f commit 29015d2

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

src/renderer/components/Oops.test.tsx

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { act } from '@testing-library/react';
1+
import { act, fireEvent } from '@testing-library/react';
2+
3+
import { PersonIcon } from '@primer/octicons-react';
24

35
import {
46
ensureStableEmojis,
@@ -43,4 +45,35 @@ describe('renderer/components/Oops.tsx', () => {
4345

4446
expect(tree.container).toMatchSnapshot();
4547
});
48+
49+
it('should render action buttons and navigate on click', async () => {
50+
const mockError = {
51+
title: 'Error title',
52+
descriptions: ['Error description'],
53+
emojis: ['🔥'],
54+
actions: [
55+
{
56+
label: 'Go somewhere',
57+
route: '/somewhere',
58+
variant: 'danger' as const,
59+
icon: PersonIcon,
60+
},
61+
],
62+
};
63+
64+
let tree: ReturnType<typeof renderWithAppContext> | null = null;
65+
66+
await act(async () => {
67+
tree = renderWithAppContext(<Oops error={mockError} />);
68+
});
69+
70+
const btn = tree.getByText('Go somewhere');
71+
expect(btn).toBeDefined();
72+
73+
await act(async () => {
74+
fireEvent.click(btn);
75+
});
76+
77+
expect(navigateMock).toHaveBeenCalledWith('/somewhere');
78+
});
4679
});

0 commit comments

Comments
 (0)