diff --git a/src/routes/Settings.test.tsx b/src/routes/Settings.test.tsx index fedbd5c71..d0b71382b 100644 --- a/src/routes/Settings.test.tsx +++ b/src/routes/Settings.test.tsx @@ -10,6 +10,7 @@ import { AppContext } from '../context/App'; import * as apiRequests from '../utils/api-requests'; import Constants from '../utils/constants'; import { SettingsRoute } from './Settings'; +import { shell } from 'electron'; const mockNavigate = jest.fn(); jest.mock('react-router-dom', () => ({ @@ -390,4 +391,30 @@ describe('routes/Settings.tsx', () => { ).parentNode.parentNode, ).toMatchSnapshot(); }); + + it('should open release notes', async () => { + let getByTitle; + + await act(async () => { + const { getByTitle: getByTitleLocal } = render( + + + + + , + ); + getByTitle = getByTitleLocal; + }); + + fireEvent.click(getByTitle('View release notes')); + expect(shell.openExternal).toHaveBeenCalledTimes(1); + expect(shell.openExternal).toHaveBeenCalledWith( + 'https://github.com/gitify-app/gitify/releases/tag/v0.0.1', + ); + }); }); diff --git a/src/routes/Settings.tsx b/src/routes/Settings.tsx index 6c3c77b31..c811940ea 100644 --- a/src/routes/Settings.tsx +++ b/src/routes/Settings.tsx @@ -20,7 +20,7 @@ import { AppContext } from '../context/App'; import { Appearance } from '../types'; import { apiRequestAuth } from '../utils/api-requests'; import { setAppearance } from '../utils/appearance'; -import { updateTrayIcon } from '../utils/comms'; +import { openExternalLink, updateTrayIcon } from '../utils/comms'; import Constants from '../utils/constants'; import { generateGitHubAPIUrl } from '../utils/helpers'; @@ -32,6 +32,12 @@ export const SettingsRoute: React.FC = () => { const [appVersion, setAppVersion] = useState(null); const [colorScope, setColorScope] = useState(false); + const openGitHubReleaseNotes = useCallback((version) => { + openExternalLink( + `https://github.com/${Constants.REPO_SLUG}/releases/tag/v${version}`, + ); + }, []); + useEffect(() => { ipcRenderer.invoke('get-platform').then((result: string) => { setIsLinux(result === 'linux'); @@ -166,8 +172,13 @@ export const SettingsRoute: React.FC = () => {
- Gitify v{appVersion} - + openGitHubReleaseNotes(appVersion)} + > + Gitify v{appVersion} +