v0.5.167: 9 новых тестов — aggregateCIDRs, v2 config, v1_legacy
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ipwhitelist",
|
"name": "ipwhitelist",
|
||||||
"version": "0.5.166",
|
"version": "0.5.167",
|
||||||
"description": "IP WhiteList microservice for cloud provider",
|
"description": "IP WhiteList microservice for cloud provider",
|
||||||
"main": "server.js",
|
"main": "server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -214,6 +214,38 @@ const { doubleCsrfProtection: dp, generateCsrfToken: gct } = csrfMiddleware.init
|
|||||||
test('initCsrf returns doubleCsrfProtection fn', typeof dp, 'function');
|
test('initCsrf returns doubleCsrfProtection fn', typeof dp, 'function');
|
||||||
test('initCsrf returns generateCsrfToken fn', typeof gct, 'function');
|
test('initCsrf returns generateCsrfToken fn', typeof gct, 'function');
|
||||||
|
|
||||||
|
// ────────────────────────────────────────────────────────────────
|
||||||
|
// 7. v2/src/config.js — IAM параметры
|
||||||
|
// ────────────────────────────────────────────────────────────────
|
||||||
|
section('v2 config');
|
||||||
|
|
||||||
|
const v2config = require('../v2/src/config');
|
||||||
|
test('iamApiBase default', v2config.iamApiBase, 'https://auth-api.ngcloud.ru/api/v1');
|
||||||
|
test('version present', typeof v2config.version, 'string');
|
||||||
|
|
||||||
|
// ────────────────────────────────────────────────────────────────
|
||||||
|
// 8. v2/src/validators — aggregateCIDRs
|
||||||
|
// ────────────────────────────────────────────────────────────────
|
||||||
|
section('v2 aggregateCIDRs');
|
||||||
|
|
||||||
|
const v2validators = require('../v2/src/validators');
|
||||||
|
test('256 /32 → /24', v2validators.aggregateCIDRs(Array.from({length:256}, (_,i)=>'1.1.0.'+i+'/32')).join(),
|
||||||
|
'1.1.0.0/24');
|
||||||
|
test('two /24 → /23', v2validators.aggregateCIDRs(['10.0.0.0/24','10.0.1.0/24']).join(),
|
||||||
|
'10.0.0.0/23');
|
||||||
|
test('two /32 → /31', v2validators.aggregateCIDRs(['192.168.1.0/32','192.168.1.1/32']).join(),
|
||||||
|
'192.168.1.0/31');
|
||||||
|
test('gap → 2 CIDRs', v2validators.aggregateCIDRs(['10.0.0.0/24','10.0.2.0/24']).length, 2);
|
||||||
|
test('single /32', v2validators.aggregateCIDRs(['5.5.5.5/32']).join(), '5.5.5.5/32');
|
||||||
|
|
||||||
|
// ────────────────────────────────────────────────────────────────
|
||||||
|
// 9. v1_legacy — старый код изолирован
|
||||||
|
// ────────────────────────────────────────────────────────────────
|
||||||
|
section('v1_legacy isolation');
|
||||||
|
|
||||||
|
test('ui/index moved', !!(() => { try { require('../ui/index'); return false; } catch { return true; }})(), true);
|
||||||
|
test('src/api/index moved', !!(() => { try { require('../src/api/index'); return false; } catch { return true; }})(), true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ────────────────────────────────────────────────────────────────
|
// ────────────────────────────────────────────────────────────────
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// ═══════════════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
version: '0.5.166',
|
version: '0.5.167',
|
||||||
|
|
||||||
// ── IAM ──────────────────────────────────────────────────────────────────
|
// ── IAM ──────────────────────────────────────────────────────────────────
|
||||||
iamUrl: process.env.V2_IAM_URL || 'https://auth-api.ngcloud.ru/api/v1/auth/user',
|
iamUrl: process.env.V2_IAM_URL || 'https://auth-api.ngcloud.ru/api/v1/auth/user',
|
||||||
|
|||||||
Reference in New Issue
Block a user