Skip to content

Commit 34f0ca6

Browse files
committed
refactor: updater
Signed-off-by: Adam Setch <[email protected]>
1 parent 6a0f24f commit 34f0ca6

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/main/updater.test.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,8 @@ describe('main/updater.ts', () => {
187187
jest.useFakeTimers();
188188
try {
189189
await updater.start();
190-
(
191-
menuBuilder.setNoUpdateAvailableMenuVisibility as jest.Mock
192-
).mockClear();
190+
191+
menuBuilder.setNoUpdateAvailableMenuVisibility.mockClear();
193192

194193
emit('update-not-available');
195194
// Immediately shows the message
@@ -211,9 +210,7 @@ describe('main/updater.ts', () => {
211210
jest.useFakeTimers();
212211
try {
213212
await updater.start();
214-
(
215-
menuBuilder.setNoUpdateAvailableMenuVisibility as jest.Mock
216-
).mockClear();
213+
menuBuilder.setNoUpdateAvailableMenuVisibility.mockClear();
217214

218215
emit('update-not-available');
219216
// Message shown
@@ -227,16 +224,14 @@ describe('main/updater.ts', () => {
227224
menuBuilder.setNoUpdateAvailableMenuVisibility,
228225
).toHaveBeenLastCalledWith(false);
229226

230-
const callsBefore = (
231-
menuBuilder.setNoUpdateAvailableMenuVisibility as jest.Mock
232-
).mock.calls.length;
227+
const callsBefore =
228+
menuBuilder.setNoUpdateAvailableMenuVisibility.mock.calls.length;
233229
jest.advanceTimersByTime(
234230
APPLICATION.UPDATE_NOT_AVAILABLE_DISPLAY_MS * 2,
235231
);
236232
// No additional hide call due to cleared timeout
237233
expect(
238-
(menuBuilder.setNoUpdateAvailableMenuVisibility as jest.Mock).mock
239-
.calls.length,
234+
menuBuilder.setNoUpdateAvailableMenuVisibility.mock.calls.length,
240235
).toBe(callsBefore);
241236
} finally {
242237
jest.useRealTimers();

0 commit comments

Comments
 (0)