Sync DNS2 production changes - removed obsolete test suite and refactored structure
This commit is contained in:
@@ -17,15 +17,15 @@ const colors = {
|
||||
yellow: '\x1b[33m',
|
||||
blue: '\x1b[34m',
|
||||
cyan: '\x1b[36m',
|
||||
magenta: '\x1b[35m',
|
||||
magenta: '\x1b[35m'
|
||||
};
|
||||
|
||||
const testResults = {
|
||||
let testResults = {
|
||||
passed: 0,
|
||||
failed: 0,
|
||||
warnings: 0,
|
||||
total: 0,
|
||||
details: [],
|
||||
details: []
|
||||
};
|
||||
|
||||
function log(message, color = 'reset') {
|
||||
@@ -62,7 +62,7 @@ async function makeRequest(path, options = {}) {
|
||||
path: url.pathname + url.search,
|
||||
method: options.method || 'GET',
|
||||
headers: options.headers || {},
|
||||
timeout: options.timeout || 10000,
|
||||
timeout: options.timeout || 10000
|
||||
};
|
||||
|
||||
const req = http.request(requestOptions, (res) => {
|
||||
@@ -74,7 +74,7 @@ async function makeRequest(path, options = {}) {
|
||||
headers: res.headers,
|
||||
body: data,
|
||||
data: data && (data.startsWith('{') || data.startsWith('[')) ?
|
||||
(() => { try { return JSON.parse(data); } catch(e) { return null; } })() : data,
|
||||
(() => { try { return JSON.parse(data); } catch(e) { return null; } })() : data
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -143,7 +143,7 @@ async function testCSRFProtection() {
|
||||
const response = await makeRequest('/api/test-endpoint', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: { test: 'data' },
|
||||
body: { test: 'data' }
|
||||
});
|
||||
|
||||
if (response.data?.error?.includes('CSRF') || response.data?.message?.includes('CSRF')) {
|
||||
@@ -183,7 +183,7 @@ async function testRequestSizeLimits() {
|
||||
const response = await makeRequest('/api/services', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(smallPayload),
|
||||
body: JSON.stringify(smallPayload)
|
||||
});
|
||||
|
||||
if (response.statusCode !== 413) {
|
||||
@@ -465,7 +465,7 @@ async function runAllTests() {
|
||||
.forEach(t => log(` ⚠ ${t.name}: ${t.message}`, 'yellow'));
|
||||
}
|
||||
|
||||
log(`\n${ '═'.repeat(60)}`, 'cyan');
|
||||
log('\n' + '═'.repeat(60), 'cyan');
|
||||
|
||||
if (testResults.failed === 0) {
|
||||
log('\n✅ ALL AUTOMATED TESTS PASSED!', 'green');
|
||||
|
||||
Reference in New Issue
Block a user