Initial commit: LinkSyncServer and LinkSyncExtension projects with complete documentation, models, API endpoints, tests, and extension implementation

This commit is contained in:
DavidSaylor
2026-05-11 17:37:10 -05:00
parent ad0b12b452
commit aed69afdfd
691 changed files with 181874 additions and 28 deletions

View File

@@ -0,0 +1,183 @@
/*
* LinkdingSync Test Orchestrator
* Main entry point for running test modules
*
* Usage in Firefox DevTools Console:
* 1. Load this file and utils/test modules
* 2. Fill in CONFIG in tests/utils.js
* 3. Run runAllTests() or specific test modules
*/
'use strict';
// ====================================================================
// ORCHESTRATOR - Main Test Runner
// ====================================================================
const LinkdingSyncTests = window.LinkdingSyncTests || {};
// Test modules registry
const TestModules = {
isolation: null,
conflicts: null,
deletion: null,
bundles: null
};
// Load test modules
function loadModules() {
// Load isolation tests
if (typeof TestIsolation !== 'undefined') {
TestModules.isolation = TestIsolation;
}
// Load conflicts tests
if (typeof TestConflicts !== 'undefined') {
TestModules.conflicts = TestConflicts;
}
// Load deletion tests
if (typeof TestDeletion !== 'undefined') {
TestModules.deletion = TestDeletion;
}
// Load bundles tests
if (typeof TestBundles !== 'undefined') {
TestModules.bundles = TestBundles;
}
console.log('[Orchestrator] Modules loaded:', Object.keys(TestModules).filter(k => TestModules[k]).join(', '));
}
// Run all tests
async function runAllTests() {
console.log(''.padEnd(60, '='));
console.log(' LINKDINGSYNC - Complete Test Suite');
console.log('='.repeat(60));
console.log('');
LinkdingSyncTests.Formatters.consoleHeader('Test Suite Execution');
const results = [];
let passed = 0;
let failed = 0;
try {
// Run isolation tests
if (TestModules.isolation) {
LinkdingSyncTests.Formatters.consoleHeader('Isolation Tests');
const result = await TestModules.isolation.run();
results.push(...result);
updateCounts(result);
}
// Run conflicts tests
if (TestModules.conflicts) {
LinkdingSyncTests.Formatters.consoleHeader('Conflict Resolution Tests');
const result = await TestModules.conflicts.run();
results.push(...result);
updateCounts(result);
}
// Run deletion tests
if (TestModules.deletion) {
LinkdingSyncTests.Formatters.consoleHeader('Deletion Tests');
const result = await TestModules.deletion.run();
results.push(...result);
updateCounts(result);
}
// Run bundles tests
if (TestModules.bundles) {
LinkdingSyncTests.Formatters.consoleHeader('Bundle Tests');
const result = await TestModules.bundles.run();
results.push(...result);
updateCounts(result);
}
} catch (error) {
console.error('Test suite error:', error.message);
console.log('');
console.log('[Orchestrator] Attempting cleanup...');
try {
await LinkdingSyncTests.Helpers.resetBookmarks();
} catch (cleanupError) {
console.error('Cleanup failed:', cleanupError.message);
}
}
// Summary
LinkdingSyncTests.Formatters.consoleHeader('Test Summary');
console.log(` Total: ${results.length}`);
console.log(` Passed: ${passed}`);
console.log(` Failed: ${failed}`);
console.log(` Warning: ${results.length - passed - failed}`);
console.log(''.padEnd(60, '='));
return results;
}
// Update pass/fail counts
function updateCounts(results) {
results.forEach(r => {
if (r.pass === true) passed++;
else if (r.pass === false) failed++;
});
}
// Run specific test module
async function runModule(moduleName) {
if (!TestModules[moduleName]) {
console.error(`[Orchestrator] Unknown module: ${moduleName}`);
return [];
}
console.log(`\nRunning ${moduleName} tests...`);
return await TestModules[moduleName].run();
}
// Reset and run all tests
async function runAllTestsWithReset() {
console.log(''.padEnd(60, '='));
console.log(' LINKDINGSYNC - Test Suite with Reset');
console.log('='.repeat(60));
try {
await LinkdingSyncTests.Helpers.resetBookmarks();
console.log('[Reset] Test bookmarks cleaned');
} catch (error) {
console.error('[Reset] Failed:', error.message);
}
return await runAllTests();
}
// ====================================================================
// EXPOSE FUNCTIONS
// ====================================================================
window.LinkdingSyncTests = {
runAllTests,
runAllTestsWithReset,
runModule,
TestModules
};
console.log('');
console.log('LinkdingSync Test Orchestrator loaded');
console.log('');
console.log('Commands:');
console.log(' runAllTests() - Run all tests');
console.log(' runAllTestsWithReset() - Run with cleanup first');
console.log(' runModule("name") - Run specific test module');
console.log(' reset() - Clean up test bookmarks');
console.log('');
// Export reset function
async function reset() {
console.log('[Orchestrator] Resetting test bookmarks...');
await LinkdingSyncTests.Helpers.resetBookmarks();
console.log('[Orchestrator] Reset complete');
}
window.LinkdingSyncTests.reset = reset;