|
1 |
| -import { fireEvent, render } from '@testing-library/react'; |
| 1 | +import { fireEvent, render, screen } from '@testing-library/react'; |
2 | 2 | import { createMemoryHistory } from 'history';
|
3 | 3 | import * as React from 'react';
|
4 | 4 | import { Router } from 'react-router';
|
@@ -102,6 +102,34 @@ describe('components/Sidebar.tsx', () => {
|
102 | 102 | );
|
103 | 103 | });
|
104 | 104 |
|
| 105 | + it('should quit the app', () => { |
| 106 | + const { getByLabelText } = render( |
| 107 | + <AppContext.Provider value={{ isLoggedIn: false, notifications: [] }}> |
| 108 | + <MemoryRouter> |
| 109 | + <Sidebar /> |
| 110 | + </MemoryRouter> |
| 111 | + </AppContext.Provider> |
| 112 | + ); |
| 113 | + fireEvent.click(getByLabelText('Quit App')); |
| 114 | + expect(ipcRenderer.send).toHaveBeenCalledTimes(1); |
| 115 | + expect(ipcRenderer.send).toHaveBeenCalledWith('app-quit'); |
| 116 | + }); |
| 117 | + |
| 118 | + it('should open the gitify repository', () => { |
| 119 | + render( |
| 120 | + <AppContext.Provider value={{ isLoggedIn: false, notifications: [] }}> |
| 121 | + <MemoryRouter> |
| 122 | + <Sidebar /> |
| 123 | + </MemoryRouter> |
| 124 | + </AppContext.Provider> |
| 125 | + ); |
| 126 | + fireEvent.click(screen.getByTestId('gitify-logo')); |
| 127 | + expect(shell.openExternal).toHaveBeenCalledTimes(1); |
| 128 | + expect(shell.openExternal).toHaveBeenCalledWith( |
| 129 | + 'https://github.com/gitify-app/gitify' |
| 130 | + ); |
| 131 | + }); |
| 132 | + |
105 | 133 | describe('should render the notifications icon', () => {
|
106 | 134 | it('when there are 0 notifications', () => {
|
107 | 135 | const { getByLabelText } = render(
|
|
0 commit comments