agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
61 lines (54 loc) • 2.06 kB
JavaScript
/**
* @file Unit tests for fileExtensions module
* @description Tests file extensions configuration module
*/
// 🔗 Tests: fileExtensions → DEFAULT_INDEX_FILES → VALID_EXTENSIONS → DEFAULT_EXTENSIONS
// Use qtests setup for consistent testing environment
const { testHelpers, createAssertions } = require('qtests');
const mod = require('./fileExtensions.js');
/**
* qtests test suite for fileExtensions
*/
function getTestSuite() {
const assert = createAssertions();
return {
'File extensions module loads correctly': async () => {
await testHelpers.withSavedEnv(async () => {
// Verify main configurations are exported
assert.truthy(mod.DEFAULT_INDEX_FILES !== undefined, 'DEFAULT_INDEX_FILES should be exported');
assert.truthy(mod.DEFAULT_TARGET_DIRS !== undefined, 'DEFAULT_TARGET_DIRS should be exported');
assert.truthy(mod.FRONTEND_EXTENSIONS !== undefined, 'FRONTEND_EXTENSIONS should be exported');
assert.truthy(mod.BACKEND_EXTENSIONS !== undefined, 'BACKEND_EXTENSIONS should be exported');
assert.truthy(mod.VALID_EXTENSIONS !== undefined, 'VALID_EXTENSIONS should be exported');
assert.truthy(mod.DEFAULT_EXTENSIONS !== undefined, 'DEFAULT_EXTENSIONS should be exported');
});
}
};
}
module.exports = { getTestSuite };
// Auto-execute when run directly (for qtests-runner compatibility)
if (require.main === module) {
(async () => {
const testSuite = getTestSuite();
let passed = 0;
let failed = 0;
for (const [testName, testFn] of Object.entries(testSuite)) {
try {
await testFn();
console.log(`✓ ${testName}`);
passed++;
} catch (error) {
console.log(`✗ ${testName}`);
console.error(`Error: ${error.message}`);
failed++;
}
}
if (failed > 0) {
console.log(`\nSummary: ${passed} passed, ${failed} failed`);
process.exit(1);
} else {
console.log(`\nSummary: ${passed} passed`);
process.exit(0);
}
})();
}