From 10ef2011beeaba8e1ff8984095414911563ab32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Sun, 31 May 2026 13:06:21 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20pre-cleanup=20=D1=83=D0=B4=D0=B0=D0=BB?= =?UTF-8?q?=D1=8F=D0=B5=D1=82=20=D1=82=D0=BE=D0=BB=D1=8C=D0=BA=D0=BE=20?= =?UTF-8?q?=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2=D1=8B=D0=B5=20CIDR,=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=B2=D1=81=D0=B5=20=D0=B7=D0=B0=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/tz-compliance.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/tz-compliance.js b/tests/tz-compliance.js index d1b8635..4a6f600 100644 --- a/tests/tz-compliance.js +++ b/tests/tz-compliance.js @@ -35,13 +35,18 @@ function bearer(t) { return { Authorization: 'Bearer ' + t }; } const tokAdmin = auth.issueMockToken({ clientId: admin.clientId, companyId: admin.companyId, companyName: admin.companyName, email: admin.email }); const tokUser = auth.issueMockToken({ clientId: user.clientId, companyId: user.companyId, companyName: user.companyName, email: user.email }); - // ── Pre-cleanup — удаляем всё что могло остаться от других тестов ── - await pool.query("UPDATE whitelist_entries SET deleted_at=NOW(), deleted_by='tz-cleanup' WHERE deleted_at IS NULL"); - console.log(' Cleanup: все активные записи удалены\n'); - const C = { A: '8.8.4.1', B: '8.8.4.2', C: '8.8.4.3', SUB: '9.9.9.0/24' }; function cidr(ip) { return ip.includes('/') ? ip : ip + '/32'; } + // ── Pre-cleanup — удаляем только тестовые CIDR ── + const testCIDRs = [cidr(C.A), cidr(C.B), cidr(C.C), cidr(C.SUB), '9.9.9.0/24', + '85.0.0.0/22', '85.0.0.0/24', '85.0.0.0/32', '86.0.0.0/24', '87.0.0.1/32', '1.2.4.1/32', + '85.0.0.0/21', '85.0.0.0/33', '::1', '192.168.1.1']; + for (const c of testCIDRs) { + await pool.query("UPDATE whitelist_entries SET deleted_at=NOW(), deleted_by='tz-cleanup' WHERE value_cidr=$1 AND deleted_at IS NULL", [c]); + } + console.log(' Pre-cleanup: тестовые CIDR удалены\n'); + // ══════════════════════════════════════════════════ // 4.1. Просмотр списка записей // ══════════════════════════════════════════════════