diff --git a/index.html b/index.html
index 360bee7..bb4d745 100644
--- a/index.html
+++ b/index.html
@@ -11,7 +11,6 @@
-
diff --git a/src/about-card.js b/src/about-card.js
index 70b56bb..bc68e48 100644
--- a/src/about-card.js
+++ b/src/about-card.js
@@ -12,12 +12,10 @@
// Get current repository context
function getCurrentRepoContext() {
let context = null;
- let source = 'unknown';
-
+
// Try to get from RepoManager first (most reliable)
if (window.RepoManager?.repoState?.currentRepo) {
context = window.RepoManager.repoState.currentRepo;
- source = 'RepoManager';
}
// Try to get from localStorage directly
else {
@@ -25,26 +23,22 @@
const current = localStorage.getItem('dashban_current_repo');
if (current) {
context = JSON.parse(current);
- source = 'localStorage';
}
} catch (error) {
console.warn('Failed to load current repo from localStorage:', error);
}
}
-
+
// Fallback to GitHub config
if (!context && window.GitHubAuth?.GITHUB_CONFIG) {
context = window.GitHubAuth.GITHUB_CONFIG;
- source = 'GitHubAuth';
}
-
+
// Final fallback
if (!context) {
context = { owner: 'super3', repo: 'dashban' };
- source = 'default';
}
-
- console.log(`📦 Repository context from ${source}:`, context);
+
return context;
}
@@ -112,7 +106,6 @@
const config = getCurrentRepoContext();
const storageKey = `aboutCardArchived_${config.owner}_${config.repo}`;
localStorage.setItem(storageKey, JSON.stringify(isArchived));
- console.log(`📦 Saved About card archived status for ${config.owner}/${config.repo}: ${isArchived}`);
} catch (error) {
console.warn('Failed to save About card archived status to localStorage:', error);
}
@@ -126,7 +119,6 @@
const storageKey = `aboutCardArchived_${config.owner}_${config.repo}`;
const saved = localStorage.getItem(storageKey);
const result = saved ? JSON.parse(saved) : false;
- console.log(`📦 Loaded About card archived status for ${config.owner}/${config.repo}: ${result}`);
return result;
} catch (error) {
console.warn('Failed to load About card archived status from localStorage:', error);
@@ -137,8 +129,7 @@
// Hide About card if it was archived
function hideAboutCardIfArchived() {
const isArchived = loadAboutCardArchivedStatus();
- console.log('📦 Checking if About card should be hidden. Archived status:', isArchived);
-
+
if (isArchived) {
const aboutCard = document.querySelector('[data-card-id="about-card"]');
if (aboutCard) {
@@ -146,12 +137,8 @@
if (typeof window.updateColumnCounts === 'function') {
window.updateColumnCounts();
}
- console.log('📦 About card hidden (was previously archived)');
- } else {
- console.log('📦 About card was marked as archived but not found in DOM');
}
} else {
- console.log('📦 About card should be visible');
// If not archived and About card doesn't exist, ensure it exists
ensureAboutCardExists();
}
@@ -161,7 +148,6 @@
function ensureAboutCardExists() {
const aboutCard = document.querySelector('[data-card-id="about-card"]');
if (!aboutCard) {
- console.log('📦 About card missing but should be visible - creating it');
// Create About card and add it to todo column (it will be moved by applyCardOrder if needed)
const todoColumn = document.getElementById('todo');
if (todoColumn) {
@@ -170,7 +156,6 @@
if (typeof window.updateColumnCounts === 'function') {
window.updateColumnCounts();
}
- console.log('📦 About card recreated in Todo column');
}
}
}
@@ -242,7 +227,6 @@
// Check if About card already exists
const existingAboutCard = document.querySelector('[data-card-id="about-card"]');
if (existingAboutCard) {
- console.log('📦 About card is already visible');
return;
}
@@ -256,7 +240,6 @@
if (typeof window.updateColumnCounts === 'function') {
window.updateColumnCounts();
}
- console.log('📦 About card restored to Todo column');
}
}
@@ -266,13 +249,10 @@
return;
}
- console.log('📦 About Card module initializing...');
-
// Set up event delegation for archive button clicks (will be called from kanban.js)
// Note: The actual event handler setup remains in kanban.js to maintain event flow
-
+
state.initialized = true;
- console.log('📦 About Card module initialized');
}
// React to board card moves: add/remove the About card's archive button
diff --git a/src/board-sync.js b/src/board-sync.js
index 6c39aa8..9fed387 100644
--- a/src/board-sync.js
+++ b/src/board-sync.js
@@ -39,8 +39,6 @@
return;
}
- console.log(`🏷️ GitHub issue #${issueNumber} moved from ${fromColumnId} to ${toColumnId}`);
-
const labelsOk = await window.safeInvoke('GitHub', 'updateGitHubIssueLabels', issueNumber, toColumnId);
let closeOk = true;
diff --git a/src/card-persistence.js b/src/card-persistence.js
index 574a375..1833727 100644
--- a/src/card-persistence.js
+++ b/src/card-persistence.js
@@ -12,12 +12,10 @@
// Get current repository context
function getCurrentRepoContext() {
let context = null;
- let source = 'unknown';
-
+
// Try to get from RepoManager first (most reliable)
if (window.RepoManager?.repoState?.currentRepo) {
context = window.RepoManager.repoState.currentRepo;
- source = 'RepoManager';
}
// Try to get from localStorage directly
else {
@@ -25,26 +23,22 @@
const current = localStorage.getItem('dashban_current_repo');
if (current) {
context = JSON.parse(current);
- source = 'localStorage';
}
} catch (error) {
console.warn('Failed to load current repo from localStorage:', error);
}
}
-
+
// Fallback to GitHub config
if (!context && window.GitHubAuth?.GITHUB_CONFIG) {
context = window.GitHubAuth.GITHUB_CONFIG;
- source = 'GitHubAuth';
}
-
+
// Final fallback
if (!context) {
context = { owner: 'super3', repo: 'dashban' };
- source = 'default';
}
-
- console.log(`📦 Repository context from ${source}:`, context);
+
return context;
}
@@ -333,10 +327,7 @@
return;
}
- console.log('💾 Card Persistence module initializing...');
-
state.initialized = true;
- console.log('💾 Card Persistence module initialized');
}
function cleanupClosedIssuesFromStorage() {
diff --git a/src/github-api.js b/src/github-api.js
index 7f06748..e5bbeb8 100644
--- a/src/github-api.js
+++ b/src/github-api.js
@@ -18,7 +18,6 @@ function notifyError(message) {
// Archive GitHub issue by adding "archive" label
async function archiveGitHubIssue(issueNumber, taskElement) {
if (!window.GitHubAuth.isGitHubAuthed()) {
- console.log('❌ Not authenticated with GitHub - cannot archive issue');
// Remove from UI anyway
taskElement.remove();
window.updateColumnCounts();
@@ -66,7 +65,6 @@ async function archiveGitHubIssue(issueNumber, taskElement) {
// Update GitHub issue labels when moved between columns
async function updateGitHubIssueLabels(issueNumber, newColumn) {
if (!window.GitHubAuth.isGitHubAuthed()) {
- console.log('❌ Not authenticated with GitHub - cannot update issue labels');
return;
}
@@ -132,7 +130,6 @@ async function updateGitHubIssueLabels(issueNumber, newColumn) {
// Update GitHub issue title
async function updateGitHubIssueTitle(issueNumber, newTitle) {
if (!window.GitHubAuth.isGitHubAuthed()) {
- console.log('❌ Not authenticated with GitHub - cannot update issue title');
return false;
}
@@ -154,7 +151,6 @@ async function updateGitHubIssueTitle(issueNumber, newTitle) {
}
const issue = await response.json();
- console.log(`✅ Successfully updated GitHub issue #${issueNumber} title to: "${newTitle}"`);
return true;
} catch (error) {
@@ -169,7 +165,6 @@ async function updateGitHubIssueTitle(issueNumber, newTitle) {
// Update GitHub issue description
async function updateGitHubIssueDescription(issueNumber, newDescription) {
if (!window.GitHubAuth.isGitHubAuthed()) {
- console.log('❌ Not authenticated with GitHub - cannot update issue description');
return false;
}
@@ -191,8 +186,7 @@ async function updateGitHubIssueDescription(issueNumber, newDescription) {
}
const issue = await response.json();
- console.log(`✅ Successfully updated GitHub issue #${issueNumber} description`);
-
+
// Update the stored raw description in the task element for future edits
const taskElement = document.querySelector(`[data-issue-number="${issueNumber}"]`);
if (taskElement) {
@@ -213,7 +207,6 @@ async function updateGitHubIssueDescription(issueNumber, newDescription) {
// Close GitHub issue when moved to Done column
async function closeGitHubIssue(issueNumber) {
if (!window.GitHubAuth.isGitHubAuthed()) {
- console.log('❌ Not authenticated with GitHub - cannot close issue');
return;
}
@@ -250,7 +243,6 @@ async function closeGitHubIssue(issueNumber) {
// Reopen GitHub issue
async function reopenGitHubIssue(issueNumber) {
if (!window.GitHubAuth.isGitHubAuthed()) {
- console.log('❌ Not authenticated with GitHub - cannot reopen issue');
return;
}
@@ -271,8 +263,6 @@ async function reopenGitHubIssue(issueNumber) {
throw new Error(`GitHub API error: ${response.status} - ${errorData.message || 'Unknown error'}`);
}
- console.log(`✅ Successfully reopened GitHub issue #${issueNumber}`);
-
} catch (error) {
console.error('❌ Failed to reopen GitHub issue:', error);
@@ -284,7 +274,6 @@ async function reopenGitHubIssue(issueNumber) {
// Update GitHub issue priority or category label
async function updateGitHubIssueMetadata(issueNumber, type, newValue) {
if (!window.GitHubAuth.isGitHubAuthed()) {
- console.log('❌ Not authenticated with GitHub - cannot update issue metadata');
return false;
}
@@ -339,7 +328,6 @@ async function updateGitHubIssueMetadata(issueNumber, type, newValue) {
throw new Error(`GitHub API error: ${updateResponse.status} - ${errorData.message || 'Unknown error'}`);
}
- console.log(`✅ Successfully updated GitHub issue #${issueNumber} ${type} to: "${newValue}"`);
return true;
} catch (error) {
@@ -354,7 +342,6 @@ async function updateGitHubIssueMetadata(issueNumber, type, newValue) {
// Create GitHub issue via API
async function createGitHubIssue(title, description, labels = []) {
if (!window.GitHubAuth.isGitHubAuthed()) {
- console.log('❌ Not authenticated with GitHub - cannot create issue');
return null;
}
@@ -522,7 +509,6 @@ async function loadGitHubIssues() {
// Handle rate limiting gracefully
if (error.message.includes('Rate limit') || error.message.includes('rate limit')) {
- console.log('📊 GitHub API rate limited - banner should be visible');
// Don't show additional alert - rate limit banner handles this
return;
}
@@ -569,7 +555,6 @@ function initializeGitHubIssues() {
// Get GitHub issue comments
async function getGitHubIssueComments(issueNumber) {
if (!window.GitHubAuth.isGitHubAuthed()) {
- console.log('❌ Not authenticated with GitHub - cannot fetch comments');
return [];
}
@@ -584,7 +569,6 @@ async function getGitHubIssueComments(issueNumber) {
}
const comments = await response.json();
- console.log(`✅ Successfully fetched ${comments.length} comments for issue #${issueNumber}`);
return comments;
} catch (error) {
@@ -599,7 +583,6 @@ async function getGitHubIssueComments(issueNumber) {
// Create GitHub issue comment
async function createGitHubIssueComment(issueNumber, commentBody) {
if (!window.GitHubAuth.isGitHubAuthed()) {
- console.log('❌ Not authenticated with GitHub - cannot create comment');
return null;
}
@@ -620,7 +603,6 @@ async function createGitHubIssueComment(issueNumber, commentBody) {
}
const comment = await response.json();
- console.log(`✅ Successfully created comment on issue #${issueNumber}`);
return comment;
} catch (error) {
diff --git a/src/issue-modal.js b/src/issue-modal.js
index fef7183..6606d3f 100644
--- a/src/issue-modal.js
+++ b/src/issue-modal.js
@@ -242,8 +242,6 @@ function setupIssueModalEventHandlers() {
// Save to GitHub API
if (window.GitHubAPI && window.GitHubAPI.updateGitHubIssueTitle) {
await window.GitHubAPI.updateGitHubIssueTitle(issueNumber, newTitle);
- } else {
- console.log('GitHub API not available, title updated locally only');
}
});
}
@@ -314,15 +312,10 @@ function setupIssueModalEventHandlers() {
// Update via GitHub API if this is a GitHub issue
if (taskElement && taskElement.hasAttribute('data-github-issue')) {
try {
- const success = await window.GitHubAPI.updateGitHubIssueDescription(issueNumber, newDesc);
- if (success) {
- console.log(`✅ Successfully updated GitHub issue #${issueNumber} description locally and on GitHub`);
- }
+ await window.GitHubAPI.updateGitHubIssueDescription(issueNumber, newDesc);
} catch (error) {
console.error('❌ Failed to update GitHub issue description:', error);
}
- } else {
- console.log(`Updated local task description: "${newDesc}"`);
}
});
}
@@ -378,8 +371,6 @@ function setupIssueModalEventHandlers() {
// Update GitHub issue labels
if (window.GitHubAPI && window.GitHubAPI.updateGitHubIssueMetadata) {
await window.GitHubAPI.updateGitHubIssueMetadata(issueNumber, 'priority', newPriority);
- } else {
- console.log('GitHub API not available, priority updated locally only');
}
});
}
@@ -432,8 +423,6 @@ function setupIssueModalEventHandlers() {
// Update GitHub issue labels
if (window.GitHubAPI && window.GitHubAPI.updateGitHubIssueMetadata) {
await window.GitHubAPI.updateGitHubIssueMetadata(issueNumber, 'category', newCategory);
- } else {
- console.log('GitHub API not available, category updated locally only');
}
});
}
@@ -482,8 +471,6 @@ function setupIssueModalEventHandlers() {
// Close issue via GitHub API
if (window.GitHubAPI && window.GitHubAPI.closeGitHubIssue) {
await window.GitHubAPI.closeGitHubIssue(issueNumber);
- } else {
- console.log('GitHub API not available, issue closed locally only');
}
});
}
@@ -527,8 +514,6 @@ function setupIssueModalEventHandlers() {
// Reopen issue via GitHub API
if (window.GitHubAPI && window.GitHubAPI.reopenGitHubIssue) {
await window.GitHubAPI.reopenGitHubIssue(issueNumber);
- } else {
- console.log('GitHub API not available, issue reopened locally only');
}
});
}
diff --git a/src/kanban.js b/src/kanban.js
index a5e97d1..8ea97eb 100644
--- a/src/kanban.js
+++ b/src/kanban.js
@@ -155,8 +155,7 @@ document.addEventListener('DOMContentLoaded', function() {
if (githubIssue) {
// Use GitHub issue data to create the task element
taskElement = window.GitHub.createGitHubIssueElement(githubIssue, false);
- console.log('✅ Created GitHub issue and local task');
-
+
// Add to appropriate column
document.getElementById(targetColumn).appendChild(taskElement);
@@ -320,7 +319,6 @@ document.addEventListener('DOMContentLoaded', function() {
}
taskElement.remove();
window.updateColumnCounts();
- console.log('📦 About card archived');
}
}
});
@@ -364,15 +362,6 @@ document.addEventListener('DOMContentLoaded', function() {
}
});
- // Add double-click to edit functionality (kept for non-GitHub cards)
- document.addEventListener('dblclick', function(e) {
- const taskElement = e.target.closest('.bg-white.border');
- if (taskElement && !taskElement.getAttribute('data-issue-number')) {
- // Add edit functionality for local tasks here
- console.log('Edit local task:', taskElement);
- }
- });
-
// Task element creation (kept for testing compatibility)
function createTaskElement(id, title, description, priority, category) {
const taskElement = document.createElement('div');
@@ -482,32 +471,6 @@ document.addEventListener('DOMContentLoaded', function() {
// Export About card restore function globally for easy access
window.restoreAboutCard = window.AboutCard ? window.AboutCard.restoreAboutCard : function() { console.warn('AboutCard module not loaded'); };
-
- // Debug function to check About card status for all repositories
- window.debugAboutCardStatus = function() {
- console.log('=== About Card Debug Info ===');
- console.log('Current repository context:', getCurrentRepoContext());
-
- // Check all stored About card statuses
- const keys = Object.keys(localStorage).filter(key => key.startsWith('aboutCardArchived_'));
- console.log('Stored About card statuses:');
- keys.forEach(key => {
- const value = localStorage.getItem(key);
- console.log(` ${key}: ${value}`);
- });
-
- // Check current repository status
- const currentStatus = window.AboutCard ? window.AboutCard.loadAboutCardArchivedStatus() : false;
- console.log('Current repository About card archived status:', currentStatus);
-
- // Check if About card exists in DOM
- const aboutCard = document.querySelector('[data-card-id="about-card"]');
- console.log('About card in DOM:', aboutCard ? 'Found' : 'Not found');
-
- console.log('=== End Debug Info ===');
- };
-
-
// Export certain functions for testing environments
const testAPI = {
diff --git a/src/labels.js b/src/labels.js
index 357c34c..98ec292 100644
--- a/src/labels.js
+++ b/src/labels.js
@@ -88,7 +88,6 @@ async function loadRequiredLabels() {
// Check which labels exist in the repository
async function checkExistingLabels() {
if (!window.GitHubAuth?.isGitHubAuthed?.()) {
- console.log('❌ Not authenticated with GitHub - cannot check labels');
return [];
}
@@ -156,7 +155,6 @@ async function installMissingLabels(missingLabels) {
if (response.ok) {
results.success.push(label.name);
- console.log(`✅ Created label: ${label.name}`);
} else {
const errorData = await response.json();
results.failed.push({ name: label.name, error: errorData.message });
diff --git a/src/logger.js b/src/logger.js
deleted file mode 100644
index ad49e61..0000000
--- a/src/logger.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Quiets Dashban's routine console output.
-//
-// The app modules log a lot of informational/lifecycle detail via console.log.
-// Loading this script first (before the other src modules) replaces console.log
-// with a version that stays silent unless debugging is explicitly enabled by
-// setting `window.DASHBAN_DEBUG = true` (e.g. from devtools). console.error and
-// console.warn are left untouched, so genuine problems still surface.
-(function () {
- 'use strict';
-
- const original = console.log.bind(console);
- console.log = function () {
- if (globalThis.DASHBAN_DEBUG) {
- original.apply(null, arguments);
- }
- };
-})();
diff --git a/src/rate-limit.js b/src/rate-limit.js
index e31a431..28479a9 100644
--- a/src/rate-limit.js
+++ b/src/rate-limit.js
@@ -62,9 +62,7 @@ async function checkRateLimit() {
} else {
hideBanner();
}
-
- console.log(`📊 GitHub API Rate Limit: ${core.remaining}/${core.limit} remaining (resets at ${new Date(core.reset * 1000).toLocaleTimeString()})`);
-
+
return {
isLimited: core.remaining === 0,
remaining: core.remaining,
@@ -224,8 +222,6 @@ function initializeRateLimitManager() {
checkRateLimit();
}
}, 5 * 60 * 1000);
-
- console.log('📊 Rate limit manager initialized');
}
// Wrapper for fetch that automatically handles rate limiting
diff --git a/src/repo.js b/src/repo.js
index 0c413bb..c8eea8c 100644
--- a/src/repo.js
+++ b/src/repo.js
@@ -54,7 +54,7 @@ async function validateRepository(owner, repo) {
}
}
} catch (error) {
- console.log('Could not determine write access, defaulting to read-only');
+ // Could not determine write access; keep the read-only default.
}
}
diff --git a/src/status-cards.js b/src/status-cards.js
index a057843..f1f9f38 100644
--- a/src/status-cards.js
+++ b/src/status-cards.js
@@ -145,11 +145,7 @@ document.addEventListener('DOMContentLoaded', function() {
}
function safeQuerySelector(selector) {
- const element = document.querySelector(selector);
- if (!element) {
- console.log(`❌ Element not found: ${selector}`);
- }
- return element;
+ return document.querySelector(selector);
}
// ============================================================================
@@ -426,8 +422,6 @@ document.addEventListener('DOMContentLoaded', function() {
// ============================================================================
function refreshStatusCardsForRepository() {
- console.log('🔄 Refreshing status cards for repository:', getCurrentRepoConfig());
-
// Clear any existing status to show loading state
const statusElements = [
document.querySelector(CONFIG.SELECTORS.FRONTEND_STATUS),
@@ -470,16 +464,10 @@ document.addEventListener('DOMContentLoaded', function() {
// Also refresh our status detection and timestamp
refreshAllStatuses();
-
- console.log('Badge refreshed manually');
});
}
-
+
if (badgeImg) {
- badgeImg.addEventListener('load', function() {
- console.log('Badge loaded successfully');
- });
-
badgeImg.addEventListener('error', function() {
console.error('Badge failed to load');
});
diff --git a/tests/about-card.test.js b/tests/about-card.test.js
index 4918821..7c1919a 100644
--- a/tests/about-card.test.js
+++ b/tests/about-card.test.js
@@ -65,17 +65,10 @@ describe('About Card Module', () => {
});
describe('initialize', () => {
- test('should initialize the module', () => {
- AboutCard.initialize();
- expect(console.log).toHaveBeenCalledWith('📦 About Card module initializing...');
- expect(console.log).toHaveBeenCalledWith('📦 About Card module initialized');
- });
-
- test('should not initialize twice', () => {
- AboutCard.initialize();
- jest.clearAllMocks();
- AboutCard.initialize();
- expect(console.log).not.toHaveBeenCalled();
+ test('should not throw when initialized once or twice', () => {
+ expect(() => AboutCard.initialize()).not.toThrow();
+ // Second call hits the early-return guard.
+ expect(() => AboutCard.initialize()).not.toThrow();
});
});
@@ -88,7 +81,7 @@ describe('About Card Module', () => {
};
AboutCard.saveAboutCardArchivedStatus(true);
- expect(console.log).toHaveBeenCalledWith('📦 Repository context from RepoManager:', { owner: 'test-owner', repo: 'test-repo' });
+ expect(mockLocalStorage.setItem).toHaveBeenCalledWith('aboutCardArchived_test-owner_test-repo', 'true');
});
test('should get context from localStorage when RepoManager not available', () => {
@@ -102,7 +95,7 @@ describe('About Card Module', () => {
AboutCard = window.AboutCard;
AboutCard.saveAboutCardArchivedStatus(true);
- expect(console.log).toHaveBeenCalledWith('📦 Repository context from localStorage:', { owner: 'local-owner', repo: 'local-repo' });
+ expect(mockLocalStorage.setItem).toHaveBeenCalledWith('aboutCardArchived_local-owner_local-repo', 'true');
});
test('should handle invalid JSON in localStorage', () => {
@@ -134,8 +127,8 @@ describe('About Card Module', () => {
AboutCard.saveAboutCardArchivedStatus(true);
expect(console.warn).toHaveBeenCalledWith('Failed to load current repo from localStorage:', expect.any(Error));
- expect(console.log).toHaveBeenCalledWith('📦 Repository context from default:', { owner: 'super3', repo: 'dashban' });
-
+ expect(mockLocalStorage.setItem).toHaveBeenCalledWith('aboutCardArchived_super3_dashban', 'true');
+
// Restore
global.JSON.parse = originalParse;
});
@@ -147,15 +140,15 @@ describe('About Card Module', () => {
};
AboutCard.saveAboutCardArchivedStatus(true);
- expect(console.log).toHaveBeenCalledWith('📦 Repository context from GitHubAuth:', { owner: 'github-owner', repo: 'github-repo' });
+ expect(mockLocalStorage.setItem).toHaveBeenCalledWith('aboutCardArchived_github-owner_github-repo', 'true');
});
test('should use default fallback', () => {
window.RepoManager = null;
window.GitHubAuth = null;
-
+
AboutCard.saveAboutCardArchivedStatus(true);
- expect(console.log).toHaveBeenCalledWith('📦 Repository context from default:', { owner: 'super3', repo: 'dashban' });
+ expect(mockLocalStorage.setItem).toHaveBeenCalledWith('aboutCardArchived_super3_dashban', 'true');
});
});
@@ -304,7 +297,6 @@ describe('About Card Module', () => {
test('should save archived status to localStorage', () => {
AboutCard.saveAboutCardArchivedStatus(true);
expect(mockLocalStorage.setItem).toHaveBeenCalledWith('aboutCardArchived_super3_dashban', 'true');
- expect(console.log).toHaveBeenCalledWith('📦 Saved About card archived status for super3/dashban: true');
});
test('should handle localStorage error', () => {
@@ -322,7 +314,6 @@ describe('About Card Module', () => {
mockStore['aboutCardArchived_super3_dashban'] = 'true';
const result = AboutCard.loadAboutCardArchivedStatus();
expect(result).toBe(true);
- expect(console.log).toHaveBeenCalledWith('📦 Loaded About card archived status for super3/dashban: true');
});
test('should return false when no saved status', () => {
@@ -337,7 +328,6 @@ describe('About Card Module', () => {
const result = AboutCard.loadAboutCardArchivedStatus();
expect(result).toBe(false);
- expect(console.log).toHaveBeenCalledWith('📦 Loaded About card archived status for super3/dashban: false');
});
test('should handle localStorage error', () => {
@@ -361,14 +351,15 @@ describe('About Card Module', () => {
AboutCard.hideAboutCardIfArchived();
expect(document.querySelector('[data-card-id="about-card"]')).toBeFalsy();
expect(window.updateColumnCounts).toHaveBeenCalled();
- expect(console.log).toHaveBeenCalledWith('📦 About card hidden (was previously archived)');
});
- test('should log when archived card not found in DOM', () => {
+ test('should not throw when archived card not found in DOM', () => {
mockStore['aboutCardArchived_super3_dashban'] = 'true';
-
- AboutCard.hideAboutCardIfArchived();
- expect(console.log).toHaveBeenCalledWith('📦 About card was marked as archived but not found in DOM');
+
+ // Archived but no card present: the in-DOM guard is false, so nothing
+ // is removed and no counts update happens.
+ expect(() => AboutCard.hideAboutCardIfArchived()).not.toThrow();
+ expect(window.updateColumnCounts).not.toHaveBeenCalled();
});
test('should ensure About card exists if not archived', () => {
@@ -377,26 +368,11 @@ describe('About Card Module', () => {
// Ensure not archived - return null to simulate no saved state
mockLocalStorage.getItem = jest.fn(() => null);
-
+
// Call the function
AboutCard.hideAboutCardIfArchived();
-
- // Check the logs
- const logs = console.log.mock.calls.map(call => call[0]);
-
- // Verify the expected flow
- expect(logs).toContain('📦 Loaded About card archived status for super3/dashban: false');
- expect(logs).toContain('📦 Checking if About card should be hidden. Archived status:');
- expect(logs).toContain('📦 About card should be visible');
-
- // Check that the archived status was logged as false
- expect(console.log).toHaveBeenCalledWith('📦 Checking if About card should be hidden. Archived status:', false);
-
- // Check that ensureAboutCardExists was called by verifying its side effects
- expect(logs).toContain('📦 About card missing but should be visible - creating it');
- expect(logs).toContain('📦 About card recreated in Todo column');
-
- // Verify the card was created
+
+ // Not archived: ensureAboutCardExists should recreate the missing card.
const todoColumn = document.getElementById('todo');
const aboutCard = todoColumn.querySelector('[data-card-id="about-card"]');
expect(aboutCard).toBeTruthy();
@@ -412,7 +388,6 @@ describe('About Card Module', () => {
const aboutCard = todoColumn.querySelector('[data-card-id="about-card"]');
expect(aboutCard).toBeTruthy();
expect(window.updateColumnCounts).toHaveBeenCalled();
- expect(console.log).toHaveBeenCalledWith('📦 About card recreated in Todo column');
});
test('should not create duplicate About card', () => {
@@ -428,8 +403,9 @@ describe('About Card Module', () => {
test('should handle missing todo column', () => {
document.body.innerHTML = '';
- AboutCard.ensureAboutCardExists();
- expect(console.log).toHaveBeenCalledWith('📦 About card missing but should be visible - creating it');
+ // No todo column: the inner guard is false, so no card is created.
+ expect(() => AboutCard.ensureAboutCardExists()).not.toThrow();
+ expect(document.querySelector('[data-card-id="about-card"]')).toBeFalsy();
});
});
@@ -464,19 +440,17 @@ describe('About Card Module', () => {
const aboutCard = todoColumn.querySelector('[data-card-id="about-card"]');
expect(aboutCard).toBeTruthy();
expect(window.updateColumnCounts).toHaveBeenCalled();
- expect(console.log).toHaveBeenCalledWith('📦 About card restored to Todo column');
});
test('should not create duplicate when About card already visible', () => {
const existingCard = document.createElement('div');
existingCard.setAttribute('data-card-id', 'about-card');
document.body.appendChild(existingCard);
-
+
AboutCard.restoreAboutCard();
-
+
const cards = document.querySelectorAll('[data-card-id="about-card"]');
expect(cards.length).toBe(1);
- expect(console.log).toHaveBeenCalledWith('📦 About card is already visible');
});
test('should handle missing todo column', () => {
@@ -513,17 +487,17 @@ describe('About Card Module', () => {
test('should handle RepoManager with truthy but invalid structure', () => {
window.RepoManager = { repoState: null };
window.GitHubAuth = null;
-
+
AboutCard.saveAboutCardArchivedStatus(true);
- expect(console.log).toHaveBeenCalledWith('📦 Repository context from default:', { owner: 'super3', repo: 'dashban' });
+ expect(mockLocalStorage.setItem).toHaveBeenCalledWith('aboutCardArchived_super3_dashban', 'true');
});
test('should handle GitHubAuth without GITHUB_CONFIG', () => {
window.RepoManager = null;
window.GitHubAuth = {};
-
+
AboutCard.saveAboutCardArchivedStatus(true);
- expect(console.log).toHaveBeenCalledWith('📦 Repository context from default:', { owner: 'super3', repo: 'dashban' });
+ expect(mockLocalStorage.setItem).toHaveBeenCalledWith('aboutCardArchived_super3_dashban', 'true');
});
test('should handle localStorage without current repo key', () => {
@@ -532,7 +506,7 @@ describe('About Card Module', () => {
mockStore['dashban_current_repo'] = null;
AboutCard.saveAboutCardArchivedStatus(true);
- expect(console.log).toHaveBeenCalledWith('📦 Repository context from default:', { owner: 'super3', repo: 'dashban' });
+ expect(mockLocalStorage.setItem).toHaveBeenCalledWith('aboutCardArchived_super3_dashban', 'true');
});
});
@@ -562,7 +536,6 @@ describe('About Card Module', () => {
expect(() => AboutCard.hideAboutCardIfArchived()).not.toThrow();
expect(document.querySelector('[data-card-id="about-card"]')).toBeFalsy();
- expect(console.log).toHaveBeenCalledWith('📦 About card hidden (was previously archived)');
});
// Covers line 170 else-path: About card recreated but
@@ -573,7 +546,6 @@ describe('About Card Module', () => {
expect(() => AboutCard.ensureAboutCardExists()).not.toThrow();
const todoColumn = document.getElementById('todo');
expect(todoColumn.querySelector('[data-card-id="about-card"]')).toBeTruthy();
- expect(console.log).toHaveBeenCalledWith('📦 About card recreated in Todo column');
});
// Covers line 256 else-path: About card restored but
@@ -585,7 +557,6 @@ describe('About Card Module', () => {
expect(() => AboutCard.restoreAboutCard()).not.toThrow();
const todoColumn = document.getElementById('todo');
expect(todoColumn.querySelector('[data-card-id="about-card"]')).toBeTruthy();
- expect(console.log).toHaveBeenCalledWith('📦 About card restored to Todo column');
});
// Exercises the module-export guard's browser path (line 296 else-branch
diff --git a/tests/card-persistence.test.js b/tests/card-persistence.test.js
index 2a49b7a..389ced1 100644
--- a/tests/card-persistence.test.js
+++ b/tests/card-persistence.test.js
@@ -104,17 +104,10 @@ describe('Card Persistence Module', () => {
});
describe('initialize', () => {
- test('should initialize the module', () => {
- CardPersistence.initialize();
- expect(console.log).toHaveBeenCalledWith('💾 Card Persistence module initializing...');
- expect(console.log).toHaveBeenCalledWith('💾 Card Persistence module initialized');
- });
-
- test('should not initialize twice', () => {
- CardPersistence.initialize();
- jest.clearAllMocks();
- CardPersistence.initialize();
- expect(console.log).not.toHaveBeenCalled();
+ test('should not throw when initialized once or twice', () => {
+ expect(() => CardPersistence.initialize()).not.toThrow();
+ // Second call hits the early-return guard.
+ expect(() => CardPersistence.initialize()).not.toThrow();
});
});
@@ -128,7 +121,6 @@ describe('Card Persistence Module', () => {
const context = CardPersistence.getCurrentRepoContext();
expect(context).toEqual({ owner: 'test-owner', repo: 'test-repo' });
- expect(console.log).toHaveBeenCalledWith('📦 Repository context from RepoManager:', context);
});
test('should get context from localStorage when RepoManager not available', () => {
@@ -137,7 +129,6 @@ describe('Card Persistence Module', () => {
const context = CardPersistence.getCurrentRepoContext();
expect(context).toEqual({ owner: 'local-owner', repo: 'local-repo' });
- expect(console.log).toHaveBeenCalledWith('📦 Repository context from localStorage:', context);
});
test('should handle invalid JSON in localStorage', () => {
@@ -157,7 +148,6 @@ describe('Card Persistence Module', () => {
const context = CardPersistence.getCurrentRepoContext();
expect(context).toEqual({ owner: 'github-owner', repo: 'github-repo' });
- expect(console.log).toHaveBeenCalledWith('📦 Repository context from GitHubAuth:', context);
});
test('should use default fallback', () => {
@@ -166,7 +156,6 @@ describe('Card Persistence Module', () => {
const context = CardPersistence.getCurrentRepoContext();
expect(context).toEqual({ owner: 'super3', repo: 'dashban' });
- expect(console.log).toHaveBeenCalledWith('📦 Repository context from default:', context);
});
});
diff --git a/tests/issue-modal.test.js b/tests/issue-modal.test.js
index 47a7456..355598b 100644
--- a/tests/issue-modal.test.js
+++ b/tests/issue-modal.test.js
@@ -620,12 +620,13 @@ describe('Issue Modal', () => {
test('should handle save title without GitHubAPI', async () => {
document.getElementById('issue-title-edit').value = 'New Title';
-
+
window.IssueModal.setupIssueModalEventHandlers();
await saveTitleBtn.click();
-
- expect(console.log).toHaveBeenCalledWith('GitHub API not available, title updated locally only');
+
+ // With no GitHubAPI present the title is still updated locally.
+ expect(document.getElementById('issue-modal-title').textContent).toBe('New Title');
});
test('should set up description editing handlers', () => {
@@ -694,7 +695,6 @@ describe('Issue Modal', () => {
expect(document.getElementById('issue-description-display').textContent).toBe('New description');
expect(descEl.textContent).toBe('New description');
- expect(console.log).toHaveBeenCalledWith('Updated local task description: "New description"');
});
test('should handle save description API error', async () => {
@@ -753,7 +753,8 @@ describe('Issue Modal', () => {
});
test('should handle priority change without API', async () => {
- // Create task element with label container
+ // Label container present but with no existing priority badge, and no
+ // getPriorityColor helper, so neither a removal nor an addition occurs.
const taskElement = document.createElement('div');
taskElement.setAttribute('data-issue-number', '123');
const labelContainer = document.createElement('div');
@@ -761,6 +762,9 @@ describe('Issue Modal', () => {
taskElement.appendChild(labelContainer);
document.body.appendChild(taskElement);
+ // getPriorityColor intentionally absent -> no replacement badge is added.
+ delete window.getPriorityColor;
+
window.IssueModal.setupIssueModalEventHandlers();
prioritySelect.value = 'High';
@@ -768,7 +772,8 @@ describe('Issue Modal', () => {
await new Promise(resolve => setTimeout(resolve, 0)); // Wait for async
- expect(console.log).toHaveBeenCalledWith('GitHub API not available, priority updated locally only');
+ // No GitHubAPI and no color helper -> the container stays empty.
+ expect(labelContainer.querySelectorAll('span').length).toBe(0);
});
test('should handle priority change without issue number element', async () => {
@@ -819,14 +824,20 @@ describe('Issue Modal', () => {
});
test('should handle category change without API', async () => {
- // Create task element with label container
+ // Create task element with label container holding an existing category badge.
const taskElement = document.createElement('div');
taskElement.setAttribute('data-issue-number', '123');
const labelContainer = document.createElement('div');
labelContainer.className = 'flex items-center space-x-2';
+ const existingBadge = document.createElement('span');
+ existingBadge.textContent = 'Frontend';
+ labelContainer.appendChild(existingBadge);
taskElement.appendChild(labelContainer);
document.body.appendChild(taskElement);
+ // getCategoryColor intentionally absent -> no replacement badge is added.
+ delete window.getCategoryColor;
+
window.IssueModal.setupIssueModalEventHandlers();
categorySelect.value = 'Backend';
@@ -834,7 +845,9 @@ describe('Issue Modal', () => {
await new Promise(resolve => setTimeout(resolve, 0)); // Wait for async
- expect(console.log).toHaveBeenCalledWith('GitHub API not available, category updated locally only');
+ // The old category badge is removed and, with no color helper, none is re-added.
+ expect(Array.from(labelContainer.querySelectorAll('span')).map(s => s.textContent)).not.toContain('Frontend');
+ expect(labelContainer.querySelectorAll('span').length).toBe(0);
});
test('should handle category change without issue number element', async () => {
@@ -891,7 +904,9 @@ describe('Issue Modal', () => {
await new Promise(resolve => setTimeout(resolve, 0)); // Wait for async
- expect(console.log).toHaveBeenCalledWith('GitHub API not available, issue closed locally only');
+ // No GitHubAPI present, but the issue is still closed locally.
+ expect(document.getElementById('issue-state-badge').textContent).toBe('Closed');
+ expect(closeIssueBtn.classList.contains('hidden')).toBe(true);
});
test('should handle close issue without issue number element', async () => {
@@ -947,7 +962,9 @@ describe('Issue Modal', () => {
await new Promise(resolve => setTimeout(resolve, 0)); // Wait for async
- expect(console.log).toHaveBeenCalledWith('GitHub API not available, issue reopened locally only');
+ // No GitHubAPI present, but the issue is still reopened locally.
+ expect(document.getElementById('issue-state-badge').textContent).toBe('Open');
+ expect(reopenIssueBtn.classList.contains('hidden')).toBe(true);
});
test('should handle reopen issue without issue number element', async () => {
@@ -1468,8 +1485,7 @@ describe('Issue Modal', () => {
// Title in modal updated even though card had no h4.
expect(document.getElementById('issue-modal-title').textContent).toBe('A New Title');
- // No GitHubAPI -> local-only log path.
- expect(console.log).toHaveBeenCalledWith('GitHub API not available, title updated locally only');
+ // No GitHubAPI present -> local-only update path.
expect(numberEl.textContent).toBe('#123');
});
@@ -1489,11 +1505,9 @@ describe('Issue Modal', () => {
// No GitHubUI -> textContent path used for display.
expect(document.getElementById('issue-description-display').textContent).toBe('Some description');
- // No matching task -> local update log.
- expect(console.log).toHaveBeenCalledWith('Updated local task description: "Some description"');
});
- test('should log success when GitHub description update resolves truthy (line 318)', async () => {
+ test('should update GitHub description when task is a GitHub issue', async () => {
document.body.innerHTML = '';
const saveDescBtn = makeButton('save-description-btn');
makeEl('div', 'issue-description-display');
@@ -1521,9 +1535,6 @@ describe('Issue Modal', () => {
await new Promise(resolve => setTimeout(resolve, 0));
expect(window.GitHubAPI.updateGitHubIssueDescription).toHaveBeenCalledWith('321', 'Updated body');
- expect(console.log).toHaveBeenCalledWith(
- '✅ Successfully updated GitHub issue #321 description locally and on GitHub'
- );
});
test('should handle priority change when no matching task element exists (line 352)', async () => {
@@ -1536,10 +1547,10 @@ describe('Issue Modal', () => {
window.IssueModal.setupIssueModalEventHandlers();
prioritySelect.value = 'High';
- prioritySelect.dispatchEvent(new Event('change'));
- await new Promise(resolve => setTimeout(resolve, 0));
- expect(console.log).toHaveBeenCalledWith('GitHub API not available, priority updated locally only');
+ // No matching task element -> the `if (taskElement)` guard is false.
+ expect(() => prioritySelect.dispatchEvent(new Event('change'))).not.toThrow();
+ await new Promise(resolve => setTimeout(resolve, 0));
});
test('should handle priority change when task has no label container (line 355)', async () => {
@@ -1560,7 +1571,8 @@ describe('Issue Modal', () => {
prioritySelect.dispatchEvent(new Event('change'));
await new Promise(resolve => setTimeout(resolve, 0));
- expect(console.log).toHaveBeenCalledWith('GitHub API not available, priority updated locally only');
+ // No label container -> no badge added to the task.
+ expect(taskElement.querySelector('span')).toBeNull();
});
test('should handle category change when no matching task element exists (line 397)', async () => {
@@ -1573,10 +1585,10 @@ describe('Issue Modal', () => {
window.IssueModal.setupIssueModalEventHandlers();
categorySelect.value = 'Backend';
- categorySelect.dispatchEvent(new Event('change'));
- await new Promise(resolve => setTimeout(resolve, 0));
- expect(console.log).toHaveBeenCalledWith('GitHub API not available, category updated locally only');
+ // No matching task element -> the `if (taskElement)` guard is false.
+ expect(() => categorySelect.dispatchEvent(new Event('change'))).not.toThrow();
+ await new Promise(resolve => setTimeout(resolve, 0));
});
test('should handle category change when task has no label container (line 400)', async () => {
@@ -1596,7 +1608,8 @@ describe('Issue Modal', () => {
categorySelect.dispatchEvent(new Event('change'));
await new Promise(resolve => setTimeout(resolve, 0));
- expect(console.log).toHaveBeenCalledWith('GitHub API not available, category updated locally only');
+ // No label container -> no badge added to the task.
+ expect(taskElement.querySelector('span')).toBeNull();
});
test('should insert category badge AFTER an existing priority badge (lines 418-424, branch 423 true)', async () => {
@@ -1652,7 +1665,6 @@ describe('Issue Modal', () => {
expect(closeIssueBtn.classList.contains('hidden')).toBe(true);
expect(reopenIssueBtn.classList.contains('hidden')).toBe(false);
- expect(console.log).toHaveBeenCalledWith('GitHub API not available, issue closed locally only');
});
test('should handle close issue when reopen button is absent at setup (line 461)', async () => {
@@ -1691,7 +1703,6 @@ describe('Issue Modal', () => {
expect(document.getElementById('done')).toBeNull();
// Task NOT moved (no done column), still attached to body.
expect(taskElement.parentElement).toBe(document.body);
- expect(console.log).toHaveBeenCalledWith('GitHub API not available, issue closed locally only');
});
test('should handle reopen issue when state badge is missing and no task (lines 501,510)', async () => {
@@ -1707,7 +1718,6 @@ describe('Issue Modal', () => {
expect(reopenIssueBtn.classList.contains('hidden')).toBe(true);
expect(closeIssueBtn.classList.contains('hidden')).toBe(false);
- expect(console.log).toHaveBeenCalledWith('GitHub API not available, issue reopened locally only');
});
test('should handle reopen issue when close button is absent at setup (line 506)', async () => {
@@ -1744,12 +1754,11 @@ describe('Issue Modal', () => {
expect(document.getElementById('backlog')).toBeNull();
expect(taskElement.parentElement).toBe(document.body);
- expect(console.log).toHaveBeenCalledWith('GitHub API not available, issue reopened locally only');
});
});
describe('save description success-resolve false branch', () => {
- test('should not log success when GitHub description update resolves falsy (line 318 false path)', async () => {
+ test('should still call the GitHub description update when it resolves falsy', async () => {
document.body.innerHTML = '';
const saveDescBtn = document.createElement('button');
saveDescBtn.id = 'save-description-btn';
@@ -1787,10 +1796,6 @@ describe('Issue Modal', () => {
await new Promise(resolve => setTimeout(resolve, 0));
expect(window.GitHubAPI.updateGitHubIssueDescription).toHaveBeenCalledWith('888', 'Body that fails to persist');
- // Success log must NOT have been emitted (success was falsy).
- expect(console.log).not.toHaveBeenCalledWith(
- expect.stringContaining('Successfully updated GitHub issue')
- );
});
});
diff --git a/tests/kanban.test.js b/tests/kanban.test.js
index ad047c9..609a989 100644
--- a/tests/kanban.test.js
+++ b/tests/kanban.test.js
@@ -1004,25 +1004,6 @@ describe('Kanban Board Core Functionality', () => {
});
});
- describe('double-click edit functionality', () => {
- test('should handle double-click events on tasks', () => {
- const taskElement = document.createElement('div');
- taskElement.className = 'bg-white border';
-
- const backlog = document.getElementById('backlog');
- backlog.appendChild(taskElement);
-
- console.log = jest.fn();
-
- // Simulate double-click
- const event = new Event('dblclick', { bubbles: true });
- taskElement.dispatchEvent(event);
-
- // Should log edit event (placeholder functionality)
- expect(console.log).toHaveBeenCalledWith('Edit local task:', taskElement);
- });
- });
-
describe('integration with GitHub module', () => {
test('should check GitHub authentication state before creating GitHub issues', () => {
const form = api.addTaskForm;
@@ -2034,23 +2015,6 @@ describe('Uncovered Lines Tests', () => {
expect(document.querySelector('[data-card-id="about-card"]')).toBeFalsy();
expect(window.updateColumnCounts).toHaveBeenCalled();
- expect(console.log).toHaveBeenCalledWith('📦 About card hidden (was previously archived)');
- });
-
- test('should log when archived About card not found in DOM (line 367)', () => {
- setupDOM();
-
- // Mock archived status without card in DOM
- global.localStorage.getItem = jest.fn().mockImplementation((key) => {
- if (key.includes('aboutCardArchived')) {
- return 'true';
- }
- return null;
- });
-
- kanbanTestExports.hideAboutCardIfArchived();
-
- expect(console.log).toHaveBeenCalledWith('📦 About card was marked as archived but not found in DOM');
});
test('should restore About card (lines 454-471)', () => {
@@ -2069,20 +2033,20 @@ describe('Uncovered Lines Tests', () => {
expect(aboutCard).toBeTruthy();
expect(aboutCard.querySelector('h4').textContent).toBe('About');
expect(window.updateColumnCounts).toHaveBeenCalled();
- expect(console.log).toHaveBeenCalledWith('📦 About card restored to Todo column');
});
test('should not restore About card if already visible (lines 458-460)', () => {
setupDOM();
-
+
// Create existing About card
const aboutCard = document.createElement('div');
aboutCard.setAttribute('data-card-id', 'about-card');
document.getElementById('todo').appendChild(aboutCard);
-
+
kanbanTestExports.restoreAboutCard();
-
- expect(console.log).toHaveBeenCalledWith('📦 About card is already visible');
+
+ // Already visible: no duplicate should be created.
+ expect(document.querySelectorAll('[data-card-id="about-card"]').length).toBe(1);
});
test('should update label warning on modal show (lines 496-497)', (done) => {
@@ -2219,13 +2183,11 @@ describe('Uncovered Lines Tests', () => {
kanbanTestExports.saveAboutCardArchivedStatus(true);
aboutCard.remove();
window.updateColumnCounts();
- console.log('📦 About card archived');
}
-
+
expect(localStorage.setItem).toHaveBeenCalled();
expect(doneColumn.querySelector('.bg-white.border')).toBeFalsy();
expect(window.updateColumnCounts).toHaveBeenCalled();
- expect(console.log).toHaveBeenCalledWith('📦 About card archived');
} finally {
// Restore localStorage
global.localStorage.getItem = originalGetItem;
@@ -2325,58 +2287,6 @@ describe('Uncovered Lines Tests', () => {
}
});
- test('should run debugAboutCardStatus function (lines 925-944)', () => {
- // Ensure clean localStorage and setup
- const originalGetItem = global.localStorage.getItem;
- const originalSetItem = global.localStorage.setItem;
- const originalKeys = Object.keys;
-
- // Create a mock storage object that supports Object.keys
- const mockStorage = {
- 'aboutCardArchived_owner1_repo1': 'true',
- 'aboutCardArchived_owner2_repo2': 'false',
- 'other_key': 'value'
- };
-
- global.localStorage.getItem = jest.fn().mockImplementation((key) => {
- return mockStorage[key] || null;
- });
- global.localStorage.setItem = jest.fn();
-
- try {
- setupDOM();
-
- // Create About card
- const aboutCard = document.createElement('div');
- aboutCard.setAttribute('data-card-id', 'about-card');
- document.body.appendChild(aboutCard);
-
- // Mock Object.keys for localStorage
- Object.keys = jest.fn().mockImplementation((obj) => {
- if (obj === localStorage) {
- return Object.keys(mockStorage);
- }
- return originalKeys(obj);
- });
-
- // Call debug function
- window.debugAboutCardStatus();
-
- expect(console.log).toHaveBeenCalledWith('=== About Card Debug Info ===');
- expect(console.log).toHaveBeenCalledWith('Current repository context:', expect.any(Object));
- expect(console.log).toHaveBeenCalledWith('Stored About card statuses:');
- expect(console.log).toHaveBeenCalledWith(' aboutCardArchived_owner1_repo1: true');
- expect(console.log).toHaveBeenCalledWith(' aboutCardArchived_owner2_repo2: false');
- expect(console.log).toHaveBeenCalledWith('About card in DOM:', 'Found');
- expect(console.log).toHaveBeenCalledWith('=== End Debug Info ===');
- } finally {
- // Restore everything
- Object.keys = originalKeys;
- global.localStorage.getItem = originalGetItem;
- global.localStorage.setItem = originalSetItem;
- }
- });
-
test('should warn when CardPersistence module not loaded for loadCardOrder (lines 522-523)', () => {
setupDOM();
@@ -2496,10 +2406,7 @@ describe('Uncovered Lines Tests', () => {
// Verify updateColumnCounts was called
expect(mockUpdateColumnCounts).toHaveBeenCalled();
-
- // Verify console.log was called
- expect(console.log).toHaveBeenCalledWith('📦 About card archived');
-
+
// Verify the card was removed from DOM
expect(document.body.contains(aboutCard)).toBe(false);
@@ -2702,7 +2609,6 @@ describe('100% coverage: document archive-btn click handler (lines 318-326)', ()
// The card should have been removed and counts updated even without AboutCard module
expect(document.body.contains(card)).toBe(false);
expect(global.window.updateColumnCounts).toHaveBeenCalled();
- expect(console.log).toHaveBeenCalledWith('📦 About card archived');
global.window.AboutCard = savedAboutCard;
});
@@ -2808,23 +2714,6 @@ describe('100% coverage: document card click -> issue modal (lines 334-343)', ()
});
});
-describe('100% coverage: dblclick handler issue-number guard (line 350)', () => {
- test('double-click on issue card (with issue number) does not log local edit (branch 79 FALSE)', () => {
- console.log = jest.fn();
-
- const card = document.createElement('div');
- card.className = 'bg-white border';
- card.setAttribute('data-issue-number', '888');
- document.body.appendChild(card);
-
- card.dispatchEvent(new MouseEvent('dblclick', { bubbles: true }));
-
- expect(console.log).not.toHaveBeenCalledWith('Edit local task:', card);
-
- card.remove();
- });
-});
-
describe('100% coverage: form submission edge branches', () => {
beforeEach(() => {
// Earlier tests in this file may clobber global.window.GitHub (e.g. timeout
@@ -2933,30 +2822,19 @@ describe('100% coverage: updateColumnCounts missing badge (branch 47 @234 FALSE)
});
});
-describe('100% coverage: debugAboutCardStatus cond-exprs (lines 480, 485, func 464)', () => {
- test('debug reports Not found and false status when AboutCard absent (branches 105, 106 FALSE + fallback fn)', () => {
+describe('100% coverage: restoreAboutCard fallback when AboutCard absent', () => {
+ test('window.restoreAboutCard falls back to a warning function when AboutCard is missing', () => {
// Re-require kanban.js with AboutCard absent so window.restoreAboutCard becomes
- // the fallback function (line 464 col 98-142) and debug cond-exprs take the false path.
+ // the fallback function (the ternary's false branch) instead of the module method.
const savedAboutCard = global.window.AboutCard;
delete global.window.AboutCard;
- console.log = jest.fn();
console.warn = jest.fn();
delete require.cache[require.resolve('../src/kanban.js')];
require('../src/kanban.js');
document.dispatchEvent(new Event('DOMContentLoaded'));
- // Ensure no About card in DOM
- const existing = document.querySelector('[data-card-id="about-card"]');
- if (existing) existing.remove();
-
- // Run debug -> exercises window.AboutCard ? ... : false and aboutCard ? 'Found' : 'Not found'
- window.debugAboutCardStatus();
-
- expect(console.log).toHaveBeenCalledWith('Current repository About card archived status:', false);
- expect(console.log).toHaveBeenCalledWith('About card in DOM:', 'Not found');
-
- // The fallback restoreAboutCard function should warn when invoked
+ // The fallback restoreAboutCard function should warn when invoked.
window.restoreAboutCard();
expect(console.warn).toHaveBeenCalledWith('AboutCard module not loaded');
diff --git a/tests/labels.test.js b/tests/labels.test.js
index 7e57cf8..5627d35 100644
--- a/tests/labels.test.js
+++ b/tests/labels.test.js
@@ -139,7 +139,6 @@ describe('GitHub Labels Management', () => {
const result = await checkExistingLabels();
expect(result).toEqual([]);
- expect(mockConsoleLog).toHaveBeenCalledWith('❌ Not authenticated with GitHub - cannot check labels');
});
test('should return empty array when not in Clerk mode', async () => {
@@ -148,7 +147,6 @@ describe('GitHub Labels Management', () => {
const result = await checkExistingLabels();
expect(result).toEqual([]);
- expect(mockConsoleLog).toHaveBeenCalledWith('❌ Not authenticated with GitHub - cannot check labels');
});
test('should handle API error response', async () => {
@@ -178,7 +176,6 @@ describe('GitHub Labels Management', () => {
const result = await checkExistingLabels();
expect(result).toEqual([]);
- expect(mockConsoleLog).toHaveBeenCalledWith('❌ Not authenticated with GitHub - cannot check labels');
});
test('should handle undefined githubAuth', async () => {
@@ -187,7 +184,6 @@ describe('GitHub Labels Management', () => {
const result = await checkExistingLabels();
expect(result).toEqual([]);
- expect(mockConsoleLog).toHaveBeenCalledWith('❌ Not authenticated with GitHub - cannot check labels');
});
});
diff --git a/tests/logger.test.js b/tests/logger.test.js
deleted file mode 100644
index 06f5857..0000000
--- a/tests/logger.test.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Tests for src/logger.js — the console.log gate that keeps the browser console
- * quiet unless window.DASHBAN_DEBUG is set.
- */
-describe('logger (console.log gate)', () => {
- let originalLog;
- let originalError;
- let originalWarn;
-
- beforeEach(() => {
- jest.resetModules();
- originalLog = console.log;
- originalError = console.error;
- originalWarn = console.warn;
- delete globalThis.DASHBAN_DEBUG;
- });
-
- afterEach(() => {
- console.log = originalLog;
- console.error = originalError;
- console.warn = originalWarn;
- delete globalThis.DASHBAN_DEBUG;
- });
-
- test('suppresses console.log by default (debugging off)', () => {
- const sink = jest.fn();
- console.log = sink; // stand in for the real console.log
- require('../src/logger.js'); // wraps console.log, capturing `sink` as the original
-
- console.log('hidden');
-
- expect(sink).not.toHaveBeenCalled();
- });
-
- test('forwards console.log when DASHBAN_DEBUG is enabled', () => {
- const sink = jest.fn();
- console.log = sink;
- require('../src/logger.js');
-
- globalThis.DASHBAN_DEBUG = true;
- console.log('shown', 1);
-
- expect(sink).toHaveBeenCalledWith('shown', 1);
- });
-
- test('leaves console.error and console.warn untouched', () => {
- const errSink = jest.fn();
- const warnSink = jest.fn();
- console.error = errSink;
- console.warn = warnSink;
- require('../src/logger.js');
-
- console.error('boom');
- console.warn('careful');
-
- expect(errSink).toHaveBeenCalledWith('boom');
- expect(warnSink).toHaveBeenCalledWith('careful');
- });
-});
diff --git a/tests/rate-limit.test.js b/tests/rate-limit.test.js
index db9e6fc..90c5b30 100644
--- a/tests/rate-limit.test.js
+++ b/tests/rate-limit.test.js
@@ -802,16 +802,13 @@ describe('Rate Limit Management', () => {
// Verify that fetch was not called (meaning checkRateLimit was not called)
expect(global.fetch).not.toHaveBeenCalled();
});
-
- test('should log initialization message', () => {
- expect(global.console.log).toHaveBeenCalledWith('📊 Rate limit manager initialized');
- });
});
describe('DOM ready states', () => {
test('should initialize immediately when DOM is ready', () => {
- // Already tested in the main initialization since DOM is ready in beforeEach
- expect(global.console.log).toHaveBeenCalledWith('📊 Rate limit manager initialized');
+ // DOM is ready in beforeEach, so initialize() runs immediately and sets
+ // up the periodic rate-limit check.
+ expect(global.setInterval).toHaveBeenCalled();
});
test('should add event listener when DOM is loading', () => {
@@ -945,8 +942,8 @@ describe('Rate Limit Management', () => {
jest.resetModules();
expect(() => require('../src/rate-limit.js')).not.toThrow();
- // Initialization completed (logged) even though no dismiss button existed.
- expect(global.console.log).toHaveBeenCalledWith('📊 Rate limit manager initialized');
+ // Initialization completed even though no dismiss button existed.
+ expect(global.setInterval).toHaveBeenCalled();
});
});
});
\ No newline at end of file
diff --git a/tests/repo.test.js b/tests/repo.test.js
index 7aad968..d206709 100644
--- a/tests/repo.test.js
+++ b/tests/repo.test.js
@@ -1175,10 +1175,9 @@ describe('Repository Management', () => {
});
describe('Additional Coverage Edge Cases', () => {
- test('validateRepository should log write access check failure', async () => {
+ test('validateRepository defaults to read-only when write access check fails', async () => {
window.GitHubAuth.githubAuth.isAuthenticated = true;
window.GitHubAuth.githubAuth.accessToken = 'test-token';
- const consoleSpy = jest.spyOn(console, 'log').mockImplementation();
const mockRepoData = {
name: 'test-repo',
@@ -1203,9 +1202,6 @@ describe('Repository Management', () => {
expect(result.valid).toBe(true);
expect(result.accessLevel).toBe('read-only');
- expect(consoleSpy).toHaveBeenCalledWith('Could not determine write access, defaulting to read-only');
-
- consoleSpy.mockRestore();
});
test('handleAddRepository should update dropdown when it exists', async () => {
diff --git a/tests/status-cards.test.js b/tests/status-cards.test.js
index 30b7ac3..0b55e61 100644
--- a/tests/status-cards.test.js
+++ b/tests/status-cards.test.js
@@ -364,10 +364,9 @@ describe('Status Cards Functions', () => {
expect(element).not.toBeNull();
});
- test('should log error and return null when element not found', () => {
+ test('should return null when element not found', () => {
const element = statusAPI.safeQuerySelector('[data-nonexistent]');
expect(element).toBeNull();
- expect(console.log).toHaveBeenCalledWith('❌ Element not found: [data-nonexistent]');
});
});
});
@@ -424,21 +423,8 @@ describe('Status Cards Functions', () => {
Date.now = jest.fn(() => mockNow);
refreshBtn.click();
-
- expect(badgeImg.src).toContain(`?t=${mockNow}`);
- expect(console.log).toHaveBeenCalledWith('Badge refreshed manually');
- });
- test('should handle badge image load event', () => {
- const badgeImg = document.getElementById('github-badge');
-
- Object.defineProperty(badgeImg, 'naturalWidth', { value: 100 });
- Object.defineProperty(badgeImg, 'naturalHeight', { value: 20 });
- Object.defineProperty(badgeImg, 'src', { value: 'test-url.svg' });
-
- badgeImg.dispatchEvent(new Event('load'));
-
- expect(console.log).toHaveBeenCalledWith('Badge loaded successfully');
+ expect(badgeImg.src).toContain(`?t=${mockNow}`);
});
test('should handle badge image error event', () => {
@@ -472,8 +458,6 @@ describe('Status Cards Functions', () => {
expect(() => {
refreshBtn.click();
}).not.toThrow();
-
- expect(console.log).toHaveBeenCalledWith('Badge refreshed manually');
});
});
@@ -1081,10 +1065,8 @@ describe('Status Cards Functions', () => {
localStatusAPI.setupBadgeDebugging();
- // Fire the click; with no badge image present the handler must not throw
- // and must still log the manual refresh message.
+ // Fire the click; with no badge image present the handler must not throw.
expect(() => refreshBtn.click()).not.toThrow();
- expect(console.log).toHaveBeenCalledWith('Badge refreshed manually');
});
});