// FILE: _St/IG_StYellow/test_ext_main_hover_disabled_v279aaa.js | ROLE: v279aaa MAIN hover 비활성 진단 회귀 검사
const assert = require('assert');
const fs = require('fs');
const path = require('path');

const root = __dirname;
const inject = fs.readFileSync(path.join(root, 'js', 'instagram_inject.js'), 'utf8');
const side = fs.readFileSync(path.join(root, 'side.js'), 'utf8');
const manifest = JSON.parse(fs.readFileSync(path.join(root, 'manifest.json'), 'utf8'));

assert.strictEqual(manifest.version, '2.3.8.3140');
assert.strictEqual(manifest.version_name, '2.3.8.314');
assert.ok(side.includes('const IGBLUE_PACKAGE_VERSION = IGBLUE_BUILD_TAG;'));
assert.ok(inject.includes('const IGBLUE_MAIN_HOVER_DIAGNOSTIC_ENABLED=false;'));
assert.ok(inject.includes('window.__IGBLUE_MAIN_HOVER_DIAGNOSTIC_ENABLED__=IGBLUE_MAIN_HOVER_DIAGNOSTIC_ENABLED;'));
assert.ok(inject.includes('if(!IGBLUE_MAIN_HOVER_DIAGNOSTIC_ENABLED)return;'));
assert.ok(inject.includes('if(!IGBLUE_MAIN_HOVER_DIAGNOSTIC_ENABLED)return false;'));
assert.ok(inject.includes('IGBLUE_MAIN_HOVER_DIAGNOSTIC_ENABLED&&teMainEnsureHoverAccountStyle();'));
assert.ok(inject.includes('const hoverDiagnosticEnabled = window.__IGBLUE_MAIN_HOVER_DIAGNOSTIC_ENABLED__ === true;'));
assert.ok(inject.includes("if(!hoverDiagnosticEnabled){\n    try{document.getElementById('IGBLUE_V114_HOVER_SELECT_STYLE')?.remove()}"));
assert.ok(inject.includes("document.addEventListener('mousemove', updateHover, true);"));
assert.ok(inject.indexOf('if(!hoverDiagnosticEnabled){') < inject.indexOf("document.addEventListener('mousemove', updateHover, true);"));
assert.ok(inject.includes('o?.[0].addEventListener("click"'));
assert.ok(inject.includes('o?.[2].addEventListener("click"'));
assert.ok(inject.includes('new CustomEvent("ndy_ig_bg_down"'));

console.log('test_ext_main_hover_disabled_v279aaa: OK');
