Skip to content

Commit 028d5f9

Browse files
authored
Merge branch 'main' into feat/filter-search
2 parents 0863454 + 5a1b9be commit 028d5f9

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/renderer/context/App.test.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,10 @@ describe('renderer/context/App.tsx', () => {
201201
});
202202
});
203203

204+
afterEach(() => {
205+
jest.clearAllMocks();
206+
});
207+
204208
it('should call loginWithPersonalAccessToken', async () => {
205209
apiRequestAuthMock.mockResolvedValueOnce(null);
206210

@@ -230,15 +234,10 @@ describe('renderer/context/App.tsx', () => {
230234
expect(fetchNotificationsMock).toHaveBeenCalledTimes(1),
231235
);
232236

233-
expect(apiRequestAuthMock).toHaveBeenCalledTimes(2);
237+
expect(apiRequestAuthMock).toHaveBeenCalledTimes(1);
234238
expect(apiRequestAuthMock).toHaveBeenCalledWith(
235239
'https://api.github.com/notifications',
236240
'HEAD',
237-
'123-456',
238-
);
239-
expect(apiRequestAuthMock).toHaveBeenCalledWith(
240-
'https://api.github.com/user',
241-
'GET',
242241
'encrypted',
243242
);
244243
});

src/renderer/context/App.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,9 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
223223
const loginWithOAuthApp = useCallback(
224224
async (data: LoginOAuthAppOptions) => {
225225
const { authOptions, authCode } = await authGitHub(data);
226+
226227
const { token, hostname } = await getToken(authCode, authOptions);
228+
227229
const updatedAuth = await addAccount(auth, 'OAuth App', token, hostname);
228230
setAuth(updatedAuth);
229231
saveState({ auth: updatedAuth, settings });
@@ -233,7 +235,9 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
233235

234236
const loginWithPersonalAccessToken = useCallback(
235237
async ({ token, hostname }: LoginPersonalAccessTokenOptions) => {
236-
await headNotifications(hostname, token);
238+
const encryptedToken = (await encryptValue(token)) as Token;
239+
await headNotifications(hostname, encryptedToken);
240+
237241
const updatedAuth = await addAccount(
238242
auth,
239243
'Personal Access Token',
@@ -248,10 +252,8 @@ export const AppProvider = ({ children }: { children: ReactNode }) => {
248252

249253
const logoutFromAccount = useCallback(
250254
async (account: Account) => {
251-
// Remove notifications for account
252255
removeAccountNotifications(account);
253256

254-
// Remove from auth state
255257
const updatedAuth = removeAccount(auth, account);
256258
setAuth(updatedAuth);
257259
saveState({ auth: updatedAuth, settings });

src/renderer/utils/notifications/handlers/checkSuite.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function getCheckSuiteAttributes(
7777

7878
return {
7979
workflowName,
80-
attemptNumber: attemptNumber ? Number.parseInt(attemptNumber) : null,
80+
attemptNumber: attemptNumber ? Number.parseInt(attemptNumber, 10) : null,
8181
status: getCheckSuiteStatus(statusDisplayName),
8282
statusDisplayName,
8383
branchName,

0 commit comments

Comments
 (0)