Skip to content

Commit 1dae7b9

Browse files
authored
Merge branch 'main' into refactor/url-constructor
2 parents b3a5a98 + 6c33a26 commit 1dae7b9

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

main.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,8 @@ menubarApp.on('ready', () => {
6060
}
6161
});
6262

63-
ipcMain.handle('get-platform', async () => {
64-
return process.platform;
65-
});
66-
ipcMain.handle('get-app-version', async () => {
67-
return app.getVersion();
68-
});
63+
ipcMain.handle('get-platform', () => process.platform);
64+
ipcMain.handle('get-app-version', () => app.getVersion());
6965

7066
ipcMain.on('reopen-window', () => menubarApp.showWindow());
7167
ipcMain.on('hide-window', () => menubarApp.hideWindow());

src/utils/helpers.test.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ describe('utils/helpers.ts', () => {
2727
});
2828
describe('isEnterpriseHost', () => {
2929
it('should return true for enterprise host', () => {
30-
expect(isEnterpriseHost('github.manos.im')).toBe(true);
31-
expect(isEnterpriseHost('api.github.manos.im')).toBe(true);
30+
expect(isEnterpriseHost('github.gitify.app')).toBe(true);
31+
expect(isEnterpriseHost('api.github.gitify.app')).toBe(true);
3232
});
3333

3434
it('should return false for non-enterprise host', () => {
@@ -49,6 +49,18 @@ describe('utils/helpers.ts', () => {
4949
});
5050
});
5151

52+
describe('generateGitHubAPIUrl', () => {
53+
it('should generate a GitHub API url - non enterprise', () => {
54+
const result = getGitHubAPIBaseUrl('github.com');
55+
expect(result).toBe('https://api.github.com');
56+
});
57+
58+
it('should generate a GitHub API url - enterprise', () => {
59+
const result = getGitHubAPIBaseUrl('github.gitify.app');
60+
expect(result).toBe('https://github.gitify.app/api/v3');
61+
});
62+
});
63+
5264
describe('generateGitHubWebUrl', () => {
5365
const mockedHtmlUrl =
5466
'https://github.com/gitify-app/notifications-test/issues/785';

0 commit comments

Comments
 (0)