Skip to content

Commit 73538d6

Browse files
committed
refactor: tanstack & zustand overhaul
Signed-off-by: Adam Setch <adam.setch@outlook.com>
1 parent 0bf9f73 commit 73538d6

10 files changed

Lines changed: 1166 additions & 1197 deletions

File tree

src/renderer/__helpers__/vitest.setup.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import '@testing-library/jest-dom/vitest';
22

3-
import { useFiltersStore } from '../stores';
3+
import { mockGitHubCloudAccount } from '../__mocks__/account-mocks';
4+
5+
import { useAccountsStore, useFiltersStore, useSettingsStore } from '../stores';
46

57
// Sets timezone to UTC for consistent date/time in tests and snapshots
68
process.env.TZ = 'UTC';
@@ -10,6 +12,12 @@ process.env.TZ = 'UTC';
1012
*/
1113
beforeEach(() => {
1214
useFiltersStore.getState().reset();
15+
useSettingsStore.getState().reset();
16+
useFiltersStore.getState().reset();
17+
useAccountsStore.setState({
18+
accounts: [mockGitHubCloudAccount],
19+
refreshAccount: vi.fn(async (account) => account),
20+
});
1321
});
1422

1523
/**

src/renderer/components/settings/AppearanceSettings.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
decreaseZoom,
2828
increaseZoom,
2929
resetZoomLevel,
30-
zoomLevelToPercentage,
3130
} from '../../utils/zoom';
3231

3332
export const AppearanceSettings: FC = () => {
@@ -40,8 +39,7 @@ export const AppearanceSettings: FC = () => {
4039
const wrapNotificationTitle = useSettingsStore(
4140
(s) => s.wrapNotificationTitle,
4241
);
43-
44-
const zoomPercentage = zoomLevelToPercentage(window.gitify.zoom.getLevel());
42+
const zoomPercentage = useSettingsStore((s) => s.zoomPercentage);
4543

4644
return (
4745
<fieldset>

src/renderer/components/settings/NotificationSettings.test.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,6 @@ describe('renderer/components/settings/NotificationSettings.tsx', () => {
3232
expect(updateSettingSpy).toHaveBeenCalledWith('groupBy', 'DATE');
3333
});
3434

35-
it('should change the fetchType radio group', async () => {
36-
await act(async () => {
37-
renderWithAppContext(<NotificationSettings />);
38-
});
39-
40-
await userEvent.click(screen.getByTestId('radio-fetchType-inactivity'));
41-
42-
expect(updateSettingSpy).toHaveBeenCalledTimes(1);
43-
expect(updateSettingSpy).toHaveBeenCalledWith('fetchType', 'INACTIVITY');
44-
});
45-
4635
describe('fetch interval settings', () => {
4736
it('should update the fetch interval values when using the buttons', async () => {
4837
await act(async () => {

0 commit comments

Comments
 (0)