Files
god_eye/desktop-operator/test.js
2025-09-29 22:06:11 +09:00

78 lines
2.6 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const fs = require('fs');
const path = require('path');
console.log('🧪 Тестирование GodEye Operator...\n');
// Проверяем синтаксис файлов
const filesToCheck = [
'src/main.js',
'src/config.js',
'src/renderer/app.js'
];
console.log('1⃣ Проверка синтаксиса файлов:');
filesToCheck.forEach(file => {
try {
const content = fs.readFileSync(file, 'utf8');
// Простая проверка на парность скобок
const braces = (content.match(/\{/g) || []).length - (content.match(/\}/g) || []).length;
const parens = (content.match(/\(/g) || []).length - (content.match(/\)/g) || []).length;
const brackets = (content.match(/\[/g) || []).length - (content.match(/\]/g) || []).length;
if (braces === 0 && parens === 0 && brackets === 0) {
console.log(`${file} - OK`);
} else {
console.log(`${file} - Неправильная структура скобок`);
}
} catch (error) {
console.log(`${file} - Ошибка чтения: ${error.message}`);
}
});
// Проверяем HTML элементы
console.log('\n2⃣ Проверка HTML элементов:');
try {
const html = fs.readFileSync('src/renderer/index.html', 'utf8');
const requiredElements = [
'auto-connect',
'connection-status-text',
'ping-indicator',
'screenshot-btn',
'fullscreen-btn',
'zoom-btn',
'pip-btn'
];
let missing = [];
requiredElements.forEach(id => {
if (html.includes(`id="${id}"`)) {
console.log(`${id} найден`);
} else {
console.log(`${id} отсутствует`);
missing.push(id);
}
});
if (missing.length === 0) {
console.log(' 🎉 Все новые UI элементы найдены!');
}
} catch (error) {
console.log(` ❌ Ошибка чтения HTML: ${error.message}`);
}
// Проверяем package.json
console.log('\n3⃣ Проверка package.json:');
try {
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
console.log(` ✅ Electron версия: ${pkg.devDependencies.electron}`);
console.log(` ✅ Socket.IO версия: ${pkg.dependencies['socket.io-client']}`);
console.log(` ✅ UUID версия: ${pkg.dependencies.uuid}`);
const scripts = Object.keys(pkg.scripts);
console.log(` ✅ Доступные скрипты: ${scripts.join(', ')}`);
} catch (error) {
console.log(` ❌ Ошибка чтения package.json: ${error.message}`);
}
console.log('\n✨ Тестирование завершено!');