DC-005: Fix all 138 broken test paths after src/ refactor

After the DC-005 module reorganization (41 files moved into src/ subdirs),
138 test suites failed because the refactor script's path-rewrite logic
missed three categories:

1. Files inside src/ doing 'require("./src/...")' — should be 'require("../...")'
2. Files in src/X/Y/ doing 'require("../../../src/...")' — should be 'require("../../...")'
3. Test files in __tests__/ with leftover 'require("../../../src/...")' paths

Root cause: the original refactor script ran before all files were moved,
so it computed relative paths against stale filesystem state.

Result:
- 30/30 test suites pass
- 879/879 tests pass (was: 18/30 suites, 614/687 tests)

Also fixed:
- routes/apps/restore.js: wrong responses import path
- routes/*/*.js: '../../src/utilities/X' → '../src/utilities/X' (depth 2 routes)
This commit is contained in:
Hermes
2026-06-13 12:16:56 -07:00
parent 9468dfc0eb
commit 7bc2a207f3
129 changed files with 591 additions and 310 deletions
+4 -4
View File
@@ -1,11 +1,11 @@
const express = require('express');
const fsp = require('fs').promises;
const path = require('path');
const { LIMITS } = require('../../constants');
const { exists } = require('../../fs-helpers');
const { ValidationError } = require('../../errors');
const { LIMITS } = require('../../../src/utilities/constants');
const { exists } = require('../../../src/utilities/fs-helpers');
const { ValidationError } = require('../../../src/utilities/errors');
const platformPaths = require('../../platform-paths');
const { ok, successMessage } = require('../../src/utils/responses');
const { ok, successMessage } = require('../src/utils/responses');
/**
* Config assets routes factory
* @param {Object} deps - Explicit dependencies
+5 -5
View File
@@ -1,11 +1,11 @@
const fsp = require('fs').promises;
const fs = require('fs');
const path = require('path');
const { CADDY } = require('../../constants');
const { exists } = require('../../fs-helpers');
const { ValidationError, AuthenticationError } = require('../../errors');
const { CADDY } = require('../../../src/utilities/constants');
const { exists } = require('../../../src/utilities/fs-helpers');
const { ValidationError, AuthenticationError } = require('../../../src/utilities/errors');
const platformPaths = require('../../platform-paths');
const { ok } = require('../../src/utils/responses');
const { ok } = require('../src/utils/responses');
/**
* Config backup routes factory
@@ -380,7 +380,7 @@ module.exports = function(deps) {
if (results.restored.includes('encryptionKey')) {
try {
// Clear the cached key so crypto-utils reloads from the new file on next use
const cryptoUtils = require('../../crypto-utils');
const cryptoUtils = require('../../../src/security/crypto-utils');
if (typeof cryptoUtils.clearCachedKey === 'function') {
cryptoUtils.clearCachedKey();
}
+4 -4
View File
@@ -1,8 +1,8 @@
const fsp = require('fs').promises;
const { validateConfig } = require('../../config-schema');
const { exists } = require('../../fs-helpers');
const { ValidationError } = require('../../errors');
const { ok, successMessage } = require('../../src/utils/responses');
const { validateConfig } = require('../../../src/utilities/config-schema');
const { exists } = require('../../../src/utilities/fs-helpers');
const { ValidationError } = require('../../../src/utilities/errors');
const { ok, successMessage } = require('../src/utils/responses');
/**
* Config settings routes factory