Skip to content

Commit 64adcfd

Browse files
committed
fix validation follow-up for oauth branch
1 parent a5994e8 commit 64adcfd

6 files changed

Lines changed: 36 additions & 18 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main, master ]
5+
branches:
6+
- '**'
7+
tags-ignore:
8+
- 'v*'
69
pull_request:
710
branches: [ main, master ]
811

options/options.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const state = {
2929
searchQuery: '',
3030
hidePinnedRepos: false
3131
};
32-
let persistedSession = null;
3332

3433
if (typeof document !== 'undefined') {
3534
document.addEventListener('DOMContentLoaded', async () => {
@@ -200,16 +199,10 @@ function setupEventListeners() {
200199

201200
document.getElementById('addRepoBtn').addEventListener('click', addRepo);
202201
document.getElementById('connectGitHubBtn').addEventListener('click', async () => {
203-
const connectionResult = await connectGitHub(toastManager);
204-
if (connectionResult.isValid) {
205-
persistedSession = connectionResult.authSession;
206-
}
202+
await connectGitHub(toastManager);
207203
});
208204
document.getElementById('clearTokenBtn').addEventListener('click', async () => {
209-
const tokenCleared = await clearToken();
210-
if (tokenCleared) {
211-
persistedSession = null;
212-
}
205+
await clearToken();
213206
});
214207

215208
// Action button toggles
@@ -578,7 +571,6 @@ async function loadSettings() {
578571
applyTheme(theme);
579572

580573
if (authSession?.accessToken) {
581-
persistedSession = authSession;
582574
applyStoredConnection(authSession);
583575
} else {
584576
syncTokenUiWithStoredCredential(false);

package-lock.json

Lines changed: 7 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
88
"test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
99
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
10-
"lint": "eslint .",
11-
"typecheck": "tsc --noEmit -p jsconfig.json",
10+
"lint": "node node_modules/eslint/bin/eslint.js .",
11+
"typecheck": "node node_modules/typescript/bin/tsc --noEmit -p jsconfig.json",
1212
"build": "node scripts/build.js",
1313
"validate": "npm run lint && npm run typecheck && npm run test:coverage && npm run build",
1414
"format": "prettier --write \"**/*.{js,json,md}\"",

tests/options-main.test.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,25 @@ describe('Options Main Functions', () => {
8888
storage: {
8989
local: {
9090
get: jest.fn((keys, callback) => {
91-
callback({ activities: [], readItems: [] });
91+
const requestedKeys = Array.isArray(keys) ? keys : [keys];
92+
const result = {};
93+
94+
requestedKeys.forEach((key) => {
95+
if (key === 'activities') {
96+
result.activities = [];
97+
}
98+
if (key === 'readItems') {
99+
result.readItems = [];
100+
}
101+
if (key === 'githubOAuthClientId') {
102+
result.githubOAuthClientId = 'Iv1.test-client-id';
103+
}
104+
if (key === 'encryptedGithubAuthSession') {
105+
result.encryptedGithubAuthSession = null;
106+
}
107+
});
108+
109+
callback(result);
92110
}),
93111
set: jest.fn((data, callback) => {
94112
if (callback) callback();

tests/state-manager.test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ global.chrome = {
2121
jest.unstable_mockModule('../shared/storage-helpers.js', () => ({
2222
getSyncItems: jest.fn(async () => ({})),
2323
getLocalItems: jest.fn(async () => ({})),
24+
getWatchedRepos: jest.fn(async () => []),
25+
setWatchedRepos: jest.fn(async () => {}),
2426
STORAGE_KEYS: {
2527
SETTINGS: ['watchedRepos', 'mutedRepos', 'snoozedRepos', 'filters', 'notifications', 'checkInterval', 'theme', 'itemExpiryHours'],
2628
ACTIVITY: ['activities', 'readItems']

0 commit comments

Comments
 (0)