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
@@ -39,7 +39,7 @@ module.exports = function({ resourceMonitor, docker, asyncHandler, log, notifica
router.get('/monitoring/stats/:containerId', asyncHandler(async (req, res) => {
const stats = resourceMonitor.getCurrentStats(req.params.containerId);
if (!stats) {
const { NotFoundError } = require('../errors');
const { NotFoundError } = require('../src/utilities/errors');
throw new NotFoundError('Container');
}
success(res, { stats });
@@ -55,7 +55,7 @@ module.exports = function({ resourceMonitor, docker, asyncHandler, log, notifica
const startTime = parseInt(req.query.startTime, 10);
const endTime = parseInt(req.query.endTime, 10);
if (Number.isNaN(startTime) || Number.isNaN(endTime) || startTime >= endTime) {
const { ValidationError } = require('../errors');
const { ValidationError } = require('../src/utilities/errors');
throw new ValidationError('Invalid startTime/endTime');
}
const result = resourceMonitor.getHistoryByRange(containerId, startTime, endTime);
@@ -74,7 +74,7 @@ module.exports = function({ resourceMonitor, docker, asyncHandler, log, notifica
const hours = parseInt(req.query.hours) || 24;
const aggregated = resourceMonitor.getAggregatedStats(req.params.containerId, hours);
if (!aggregated) {
const { NotFoundError } = require('../errors');
const { NotFoundError } = require('../src/utilities/errors');
throw new NotFoundError('Monitoring data');
}
success(res, { aggregated, hours });
@@ -92,7 +92,7 @@ module.exports = function({ resourceMonitor, docker, asyncHandler, log, notifica
router.post('/monitoring/alerts/config', asyncHandler(async (req, res) => {
const { configs } = req.body;
if (!configs || typeof configs !== 'object') {
const { ValidationError } = require('../errors');
const { ValidationError } = require('../src/utilities/errors');
throw new ValidationError('configs object required');
}
for (const [containerId, config] of Object.entries(configs)) {