Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("sets the idle icon when receiving an idle event", async () => {
await expect(handler({newState: Idle})).resolves.not.toBeDefined();
expect(menubarMock.tray.setImage).toHaveBeenCalledWith(icons.getIdleIcon());
expect(menubarMock.appState).toEqual(Idle);
});
it("starts the sia backend if sia conf is true but not running", async () => {
getConfig.mockResolvedValueOnce({
sia: true,
syncFolder,
});
await popup();
expect(getConfig).toHaveBeenCalled();
expect(siaStart).toHaveBeenCalledWith(syncFolder);
expect(app.quit).not.toHaveBeenCalled();
expect(menubarMock.tray.setImage).toHaveBeenCalledWith(
icons.getSyncIcon()
);
expect(menubarMock.appState).toEqual(Synchronizing);
});
it("sets the paused icon when the state is Paused", async () => {
await expect(handler(Paused)).resolves.toEqual(Paused);
expect(menubarMock.tray.setImage).toHaveBeenCalledWith(
icons.getPausedIcon()
);
expect(menubarMock.appState).toEqual(Paused);
});
await popup();
expect(menubar).toHaveBeenCalledWith({
index: `file://${path.join(__dirname, "../../../src/main/popup.html")}`,
icon: icons.getSyncIcon(),
tooltip: app.getName(),
preloadWindow: true,
width: DefaultWidth,
height: DefaultHeight,
alwaysOnTop: true,
showDockIcon: false,
webPreferences: {
nodeIntegration: true,
},
});
expect(setSkipTaskBar).toHaveBeenCalledWith(true);
expect(menubarMock.appState).toEqual(Synchronizing);
} finally {
setSkipTaskBar.mockRestore();
}
});