agentsqripts
Version:
Comprehensive static code analysis toolkit for identifying technical debt, security vulnerabilities, performance issues, and code quality problems
56 lines (49 loc) • 1.56 kB
JavaScript
/**
* @file Unit tests for securityPatterns module
* @description Tests security patterns configuration module
*/
// Use qtests setup for consistent testing environment
const { testHelpers, createAssertions } = require('qtests');
const mod = require('./securityPatterns.js');
/**
* qtests test suite for securityPatterns
*/
function getTestSuite() {
const assert = createAssertions();
return {
'Security patterns module loads correctly': async () => {
await testHelpers.withSavedEnv(async () => {
// Verify main configurations are exported
assert.truthy(mod.COMMON_PATTERNS !== undefined, 'COMMON_PATTERNS should be exported');
assert.truthy(mod.JAVASCRIPT_PATTERNS !== undefined, 'JAVASCRIPT_PATTERNS 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);
}
})();
}