Skip to content

Commit 1e127d3

Browse files
authored
Merge branch 'main' into feat/filter-search
2 parents ade4e3c + d960502 commit 1e127d3

File tree

13 files changed

+63
-31
lines changed

13 files changed

+63
-31
lines changed

src/renderer/__helpers__/jest.setup.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,5 @@ global.CSS = {
6767
return false;
6868
}),
6969
};
70+
71+
window.HTMLMediaElement.prototype.play = jest.fn();

src/renderer/components/avatars/AvatarWithFallback.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { render, screen } from '@testing-library/react';
1+
import { fireEvent, render, screen } from '@testing-library/react';
22

33
import { type Link, Size } from '../../types';
44
import {
@@ -47,8 +47,8 @@ describe('renderer/components/avatars/AvatarWithFallback.tsx', () => {
4747
// Find the avatar element by its alt text
4848
const avatar = screen.getByAltText('gitify-app') as HTMLImageElement;
4949

50-
// Simulate an error event on the image element
51-
avatar.dispatchEvent(new Event('error'));
50+
// Simulate image load error (wrapped in act via fireEvent)
51+
fireEvent.error(avatar);
5252

5353
expect(screen.getByTestId('avatar')).toMatchSnapshot();
5454
});
@@ -59,8 +59,8 @@ describe('renderer/components/avatars/AvatarWithFallback.tsx', () => {
5959
// Find the avatar element by its alt text
6060
const avatar = screen.getByAltText('gitify-app') as HTMLImageElement;
6161

62-
// Simulate an error event on the image element
63-
avatar.dispatchEvent(new Event('error'));
62+
// Simulate image load error (wrapped in act via fireEvent)
63+
fireEvent.error(avatar);
6464

6565
expect(screen.getByTestId('avatar')).toMatchSnapshot();
6666
});

src/renderer/components/avatars/__snapshots__/AvatarWithFallback.test.tsx.snap

Lines changed: 28 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/components/layout/Page.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Page } from './Page';
44

55
describe('renderer/components/layout/Page.tsx', () => {
66
it('should render itself & its children', () => {
7-
const tree = render(<Page id="test">Test</Page>);
7+
const tree = render(<Page testId="test">Test</Page>);
88

99
expect(tree).toMatchSnapshot();
1010
});

src/renderer/components/layout/Page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ import { Box } from '@primer/react';
44

55
interface IPage {
66
children: ReactNode;
7-
id: string;
7+
testId?: string;
88
}
99

1010
/**
1111
* Page component represents a single page view.
1212
* It creates a column layout for header, content, and footer.
1313
* The height is 100% to fill the parent container.
1414
*/
15-
export const Page: FC<IPage> = ({ children, id }) => {
15+
export const Page: FC<IPage> = ({ children, testId }) => {
1616
return (
17-
<Box className="flex flex-col h-screen" data-testid={id}>
17+
<Box className="flex flex-col h-screen" data-testid={testId}>
1818
{children}
1919
</Box>
2020
);

src/renderer/routes/Accounts.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const AccountsRoute: FC = () => {
110110
}, []);
111111

112112
return (
113-
<Page id="accounts">
113+
<Page testId="accounts">
114114
<Header icon={PersonIcon}>Accounts</Header>
115115

116116
<Contents>

src/renderer/routes/Filters.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const FiltersRoute: FC = () => {
1818
const { clearFilters } = useContext(AppContext);
1919

2020
return (
21-
<Page id="filters">
21+
<Page testId="filters">
2222
<Header fetchOnBack icon={FilterIcon}>
2323
Filters
2424
</Header>

src/renderer/routes/LoginWithOAuthApp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export const LoginWithOAuthAppRoute: FC = () => {
133133
);
134134

135135
return (
136-
<Page id="Login With OAuth App">
136+
<Page testId="Login With OAuth App">
137137
<Header icon={PersonIcon}>Login with OAuth App</Header>
138138

139139
<Contents>

src/renderer/routes/LoginWithPersonalAccessToken.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export const LoginWithPersonalAccessTokenRoute: FC = () => {
125125
);
126126

127127
return (
128-
<Page id="Login With Personal Access Token">
128+
<Page testId="Login With Personal Access Token">
129129
<Header icon={KeyIcon}>Login with Personal Access Token</Header>
130130

131131
<Contents>

src/renderer/routes/Notifications.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const NotificationsRoute: FC = () => {
3737
}
3838

3939
return (
40-
<Page id="notifications">
40+
<Page testId="notifications">
4141
<Contents paddingHorizontal={false}>
4242
{notifications.map((accountNotifications) => (
4343
<AccountNotifications

0 commit comments

Comments
 (0)