mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-11-21 16:38:41 -06:00
SDA-1955: refactor method names appropriately
Signed-off-by: Vishwas Shashidhar <vishwas.shashidhar@symphony.com>
This commit is contained in:
parent
c9d0260ff1
commit
45acfc27fe
@ -101,7 +101,7 @@ jest.mock('../src/app/download-handler', () => {
|
||||
setWindow: jest.fn(),
|
||||
openFile: jest.fn(),
|
||||
showInFinder: jest.fn(),
|
||||
clearDownloadItems: jest.fn(),
|
||||
clearDownloadedItems: jest.fn(),
|
||||
},
|
||||
};
|
||||
});
|
||||
@ -226,7 +226,7 @@ describe('main api handler', () => {
|
||||
it('should call `openFile` correctly', () => {
|
||||
const spy = jest.spyOn(downloadHandler, 'openFile');
|
||||
const value = {
|
||||
cmd: apiCmds.openDownloadItem,
|
||||
cmd: apiCmds.openDownloadedItem,
|
||||
id: '12345678',
|
||||
};
|
||||
const expectedValue = '12345678';
|
||||
@ -237,7 +237,7 @@ describe('main api handler', () => {
|
||||
it('should not call `openFile` if id is not a string', () => {
|
||||
const spy = jest.spyOn(downloadHandler, 'openFile');
|
||||
const value = {
|
||||
cmd: apiCmds.openDownloadItem,
|
||||
cmd: apiCmds.openDownloadedItem,
|
||||
id: 10,
|
||||
};
|
||||
ipcMain.send(apiName.symphonyApi, value);
|
||||
@ -247,7 +247,7 @@ describe('main api handler', () => {
|
||||
it('should call `showFile` correctly', () => {
|
||||
const spy = jest.spyOn(downloadHandler, 'showInFinder');
|
||||
const value = {
|
||||
cmd: apiCmds.showDownloadItem,
|
||||
cmd: apiCmds.showDownloadedItem,
|
||||
id: `12345678`,
|
||||
};
|
||||
const expectedValue = '12345678';
|
||||
@ -258,7 +258,7 @@ describe('main api handler', () => {
|
||||
it('should not call `showFile` if id is not a string', () => {
|
||||
const spy = jest.spyOn(downloadHandler, 'showInFinder');
|
||||
const value = {
|
||||
cmd: apiCmds.showDownloadItem,
|
||||
cmd: apiCmds.showDownloadedItem,
|
||||
id: 10,
|
||||
};
|
||||
ipcMain.send(apiName.symphonyApi, value);
|
||||
@ -266,9 +266,9 @@ describe('main api handler', () => {
|
||||
});
|
||||
|
||||
it('should call `clearItems` correctly', () => {
|
||||
const spy = jest.spyOn(downloadHandler, 'clearDownloadItems');
|
||||
const spy = jest.spyOn(downloadHandler, 'clearDownloadedItems');
|
||||
const value = {
|
||||
cmd: apiCmds.clearDownloadItems,
|
||||
cmd: apiCmds.clearDownloadedItems,
|
||||
};
|
||||
ipcMain.send(apiName.symphonyApi, value);
|
||||
expect(spy).toBeCalled();
|
||||
|
@ -100,7 +100,7 @@ class DownloadHandler {
|
||||
/**
|
||||
* Clears download items
|
||||
*/
|
||||
public clearDownloadItems(): void {
|
||||
public clearDownloadedItems(): void {
|
||||
this.items = [];
|
||||
}
|
||||
|
||||
|
@ -151,18 +151,18 @@ ipcMain.on(apiName.symphonyApi, async (event: Electron.IpcMainEvent, arg: IApiAr
|
||||
downloadManagerAction(arg.type, arg.path);
|
||||
}
|
||||
break;
|
||||
case apiCmds.openDownloadItem:
|
||||
case apiCmds.openDownloadedItem:
|
||||
if (typeof arg.id === 'string') {
|
||||
downloadHandler.openFile(arg.id);
|
||||
}
|
||||
break;
|
||||
case apiCmds.showDownloadItem:
|
||||
case apiCmds.showDownloadedItem:
|
||||
if (typeof arg.id === 'string') {
|
||||
downloadHandler.showInFinder(arg.id);
|
||||
}
|
||||
break;
|
||||
case apiCmds.clearDownloadItems:
|
||||
downloadHandler.clearDownloadItems();
|
||||
case apiCmds.clearDownloadedItems:
|
||||
downloadHandler.clearDownloadedItems();
|
||||
break;
|
||||
case apiCmds.isMisspelled:
|
||||
if (typeof arg.word === 'string') {
|
||||
|
@ -39,9 +39,9 @@ export enum apiCmds {
|
||||
getCPUUsage = 'get-cpu-usage',
|
||||
checkMediaPermission = 'check-media-permission',
|
||||
registerDownloadHandler = 'register-download-handler',
|
||||
openDownloadItem = 'open-download-item',
|
||||
showDownloadItem = 'show-download-item',
|
||||
clearDownloadItems = 'clear-download-items',
|
||||
openDownloadedItem = 'open-downloaded-item',
|
||||
showDownloadedItem = 'show-downloaded-item',
|
||||
clearDownloadedItems = 'clear-downloaded-items',
|
||||
}
|
||||
|
||||
export enum apiName {
|
||||
|
@ -215,9 +215,9 @@
|
||||
registerAnalyticHandler: 'register-analytic-handler',
|
||||
registerActivityDetection: 'register-activity-detection',
|
||||
registerDownloadHandler: 'register-download-handler',
|
||||
openDownloadItem: 'open-download-item',
|
||||
showDownloadItem: 'show-download-item',
|
||||
clearDownloadItems: 'clear-download-items',
|
||||
openDownloadedItem: 'open-downloaded-item',
|
||||
showDownloadedItem: 'show-downloaded-item',
|
||||
clearDownloadedItems: 'clear-downloaded-items',
|
||||
showNotificationSettings: 'show-notification-settings',
|
||||
sanitize: 'sanitize',
|
||||
bringToFront: 'bring-to-front',
|
||||
@ -868,7 +868,7 @@
|
||||
if (window.ssf) {
|
||||
window.ssf.openDownloadedItem(id);
|
||||
} else {
|
||||
postMessage(apiCmds.openDownloadItem, id);
|
||||
postMessage(apiCmds.openDownloadedItem, id);
|
||||
}
|
||||
});
|
||||
|
||||
@ -880,7 +880,7 @@
|
||||
if (window.ssf) {
|
||||
window.ssf.showDownloadedItem(id);
|
||||
} else {
|
||||
postMessage(apiCmds.showDownloadItem, id);
|
||||
postMessage(apiCmds.showDownloadedItem, id);
|
||||
}
|
||||
});
|
||||
|
||||
@ -889,7 +889,7 @@
|
||||
if (window.ssf) {
|
||||
window.ssf.clearDownloadedItems();
|
||||
} else {
|
||||
postMessage(apiCmds.clearDownloadItems);
|
||||
postMessage(apiCmds.clearDownloadedItems);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -109,17 +109,17 @@ export class AppBridge {
|
||||
ssf.setBadgeCount(data as number);
|
||||
}
|
||||
break;
|
||||
case apiCmds.openDownloadItem:
|
||||
case apiCmds.openDownloadedItem:
|
||||
if (typeof data === 'string') {
|
||||
ssf.openDownloadedItem(data as string);
|
||||
}
|
||||
break;
|
||||
case apiCmds.showDownloadItem:
|
||||
case apiCmds.showDownloadedItem:
|
||||
if (typeof data === 'string') {
|
||||
ssf.showDownloadedItem(data as string);
|
||||
}
|
||||
break;
|
||||
case apiCmds.clearDownloadItems:
|
||||
case apiCmds.clearDownloadedItems:
|
||||
ssf.clearDownloadedItems();
|
||||
break;
|
||||
case apiCmds.setLocale:
|
||||
|
@ -104,21 +104,21 @@ const throttledSetCloudConfig = throttle((data) => {
|
||||
|
||||
const throttledOpenDownloadedItem = throttle((id: string) => {
|
||||
ipcRenderer.send(apiName.symphonyApi, {
|
||||
cmd: apiCmds.openDownloadItem,
|
||||
cmd: apiCmds.openDownloadedItem,
|
||||
id,
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
const throttledShowDownloadedItem = throttle((id: string) => {
|
||||
ipcRenderer.send(apiName.symphonyApi, {
|
||||
cmd: apiCmds.showDownloadItem,
|
||||
cmd: apiCmds.showDownloadedItem,
|
||||
id,
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
const throttledClearDownloadedItems = throttle(() => {
|
||||
ipcRenderer.send(apiName.symphonyApi, {
|
||||
cmd: apiCmds.clearDownloadItems,
|
||||
cmd: apiCmds.clearDownloadedItems,
|
||||
});
|
||||
}, 1000);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user