Skip to content

Commit a6c8235

Browse files
authored
test: vitest setup and cleanup (#2726)
* test(vitest): cleanup Signed-off-by: Adam Setch <adam.setch@outlook.com> * test: format test Signed-off-by: Adam Setch <adam.setch@outlook.com> --------- Signed-off-by: Adam Setch <adam.setch@outlook.com>
1 parent 02254e4 commit a6c8235

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+40
-230
lines changed

src/main/events.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ type MockMenubar = {
1919
};
2020

2121
describe('main/events', () => {
22-
beforeEach(() => {
23-
vi.clearAllMocks();
24-
});
25-
2622
it('onMainEvent registers ipcMain.on listener', () => {
2723
const listenerMock = vi.fn();
2824

src/main/handlers/app.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ describe('main/handlers/app.ts', () => {
2828
let menubar: Menubar;
2929

3030
beforeEach(() => {
31-
vi.clearAllMocks();
32-
3331
menubar = {
3432
showWindow: vi.fn(),
3533
hideWindow: vi.fn(),

src/main/handlers/storage.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ vi.mock('../../shared/logger', () => ({
2020
}));
2121

2222
describe('main/handlers/storage.ts', () => {
23-
beforeEach(() => {
24-
vi.clearAllMocks();
25-
});
26-
2723
describe('registerStorageHandlers', () => {
2824
it('registers handlers without throwing', () => {
2925
expect(() => registerStorageHandlers()).not.toThrow();

src/main/handlers/system.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ describe('main/handlers/system.ts', () => {
2626
let menubar: Menubar;
2727

2828
beforeEach(() => {
29-
vi.clearAllMocks();
30-
3129
menubar = {
3230
showWindow: vi.fn(),
3331
hideWindow: vi.fn(),

src/main/handlers/tray.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ describe('main/handlers/tray.ts', () => {
2020
let menubar: Menubar;
2121

2222
beforeEach(() => {
23-
vi.clearAllMocks();
24-
2523
menubar = {
2624
tray: {
2725
isDestroyed: vi.fn().mockReturnValue(false),

src/main/lifecycle/first-run.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ function configPath() {
5252

5353
describe('main/lifecycle/first-run', () => {
5454
beforeEach(() => {
55-
vi.clearAllMocks();
5655
mac = true;
5756
});
5857

src/main/lifecycle/reset.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ function createMb() {
2323
}
2424

2525
describe('main/lifecycle/reset.ts', () => {
26-
beforeEach(() => {
27-
vi.clearAllMocks();
28-
});
29-
3026
it('sends reset event and quits when user confirms', () => {
3127
vi.mocked(dialog.showMessageBoxSync).mockReturnValue(1);
3228
const mb = createMb();

src/main/lifecycle/startup.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ function createMb() {
4343
}
4444

4545
describe('main/lifecycle/startup.ts', () => {
46-
beforeEach(() => {
47-
vi.clearAllMocks();
48-
});
49-
5046
describe('initializeAppLifecycle', () => {
5147
it('registers menubar ready handler', () => {
5248
const mb = createMb();

src/main/lifecycle/window.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ describe('main/lifecycle/window.ts', () => {
1313
let menubar: Menubar;
1414

1515
beforeEach(() => {
16-
vi.clearAllMocks();
17-
1816
menubar = {
1917
hideWindow: vi.fn(),
2018
tray: {

src/main/menu.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ describe('main/menu.ts', () => {
8888
};
8989

9090
beforeEach(() => {
91-
vi.clearAllMocks();
9291
vi.mocked(isMacOS).mockReturnValue(false);
9392
menuItemInstances.length = 0; // Clear tracked instances
9493
menubar = { app: { quit: vi.fn() } } as unknown as Menubar;

0 commit comments

Comments
 (0)