Skip to content

Commit 04cfba4

Browse files
committed
test: refactor render with app context
Signed-off-by: Adam Setch <[email protected]>
1 parent d8a31f0 commit 04cfba4

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

src/main/updater.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,12 @@ describe('main/updater.ts', () => {
205205
});
206206

207207
it('performs initial check and schedules periodic checks', async () => {
208-
const originalSetInterval = global.setInterval;
208+
const originalSetInterval = globalThis.setInterval;
209209
const setIntervalSpy = jest
210-
.spyOn(global, 'setInterval')
210+
.spyOn(globalThis, 'setInterval')
211211
.mockImplementation(((fn: () => void) => {
212212
fn();
213-
return 0 as unknown as NodeJS.Timer;
213+
return 0 as unknown as NodeJS.Timeout;
214214
}) as unknown as typeof setInterval);
215215
try {
216216
await updater.start();
@@ -224,7 +224,7 @@ describe('main/updater.ts', () => {
224224
);
225225
} finally {
226226
setIntervalSpy.mockRestore();
227-
global.setInterval = originalSetInterval;
227+
globalThis.setInterval = originalSetInterval;
228228
}
229229
});
230230
});

src/renderer/components/AllRead.test.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@ describe('renderer/components/AllRead.tsx', () => {
1313
});
1414

1515
it('should render itself & its children - no filters', async () => {
16-
let tree: ReturnType<typeof renderWithAppContext> | null = null;
17-
18-
await act(async () => {
19-
tree = renderWithAppContext(<AllRead />, {
20-
settings: {
21-
...mockSettings,
22-
},
23-
});
16+
const tree = renderWithAppContext(<AllRead />, {
17+
settings: {
18+
...mockSettings,
19+
},
2420
});
2521

2622
expect(tree).toMatchSnapshot();

src/renderer/components/notifications/NotificationRow.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('renderer/components/notifications/NotificationRow.tsx', () => {
7171

7272
it('should render itself & its children - notification is read', async () => {
7373
jest
74-
.spyOn(global.Date, 'now')
74+
.spyOn(globalThis.Date, 'now')
7575
.mockImplementation(() => new Date('2024').valueOf());
7676

7777
const props = {

0 commit comments

Comments
 (0)