Skip to content

Commit 8ea2773

Browse files
committed
feat(accounts): warn when missing scopes
Signed-off-by: Adam Setch <[email protected]>
1 parent 9ed8a98 commit 8ea2773

File tree

3 files changed

+887
-12
lines changed

3 files changed

+887
-12
lines changed

src/renderer/__mocks__/state-mocks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ export const mockPersonalAccessTokenAccount: Account = {
3434
token: 'token-123-456' as Token,
3535
hostname: Constants.DEFAULT_AUTH_OPTIONS.hostname,
3636
user: mockGitifyUser,
37+
hasRequiredScopes: true,
3738
};
3839

3940
export const mockOAuthAccount: Account = {

src/renderer/routes/Accounts.test.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,34 @@ describe('renderer/routes/Accounts.tsx', () => {
5757
expect(screen.getByTestId('accounts')).toMatchSnapshot();
5858
});
5959

60+
it('should render with PAT scopes warning', async () => {
61+
await act(async () => {
62+
render(
63+
<AppContext.Provider
64+
value={{
65+
auth: {
66+
accounts: [
67+
{
68+
...mockPersonalAccessTokenAccount,
69+
hasRequiredScopes: false,
70+
},
71+
mockOAuthAccount,
72+
mockGitHubAppAccount,
73+
],
74+
},
75+
settings: mockSettings,
76+
}}
77+
>
78+
<MemoryRouter>
79+
<AccountsRoute />
80+
</MemoryRouter>
81+
</AppContext.Provider>,
82+
);
83+
});
84+
85+
expect(screen.getByTestId('accounts')).toMatchSnapshot();
86+
});
87+
6088
it('should go back by pressing the icon', async () => {
6189
await act(async () => {
6290
render(

0 commit comments

Comments
 (0)