// FILE: _St/IG_StYellow/test_ext_cache8701_logging_v304.js | ROLE: Cache8701 선택 로그·비활성 OWNER 감시 회귀
const fs = require('fs');
const path = require('path');
const assert = require('assert');

const root = __dirname;
const side = fs.readFileSync(path.join(root, 'side.js'), 'utf8');
const background = fs.readFileSync(path.join(root, 'background.js'), 'utf8');
const cache = fs.readFileSync(path.join(root, '..', 'Cache8701', 'cache8701_main.py'), 'utf8');

assert.ok(side.includes('igblue_settings_cache8701_file_logging'));
assert.ok(side.includes('8701에 로깅'));
assert.ok(side.includes('cache8701_file_logging: false'));
assert.ok(background.includes('"cache8701_file_logging"'));
assert.ok(cache.includes('cache8701_log_*.log'));
assert.ok(cache.includes('while True:'));
assert.ok(cache.includes('if len(files) < keep'));
assert.ok(cache.includes('files[0][1].unlink()'));
assert.ok(cache.includes('OWNER active=false는 사용자가 다른 탭을 보고 있다는 뜻일 뿐 CDP target 단절이 아니다.'));
assert.ok(!cache.includes('if not connection.get("owner_active") or not connection.get("targets")'));
assert.ok(cache.includes('def connection_can_watch'));

console.log('OK test_ext_cache8701_logging_v304');
