Разделить среды и закрепить лицензии в HEADER 1.0

This commit is contained in:
AidarKC
2026-12-05 11:42:20 +03:00
parent a64168a748
commit 77c7021aed
89 changed files with 4204 additions and 211 deletions
+21 -17
View File
@@ -1,21 +1,25 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import path from 'node:path';
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
const read = (p) => fs.readFileSync(path.join(root, p), 'utf8');
test('CORE эпоха одинакова в UI, Server, discovery и сертификате; viewer', () => {
const ui = read('shine-UI/js/services/protocol-tags.js');
const server = read('SHiNE-server/shine-server-blockchain/src/main/java/blockchain/ShineProtocolTags.java');
const viewer = read('shine-UI/static-sites/arweave-viewer/index.html');
const reg = read('SHiNE-server/shine-server-archive/src/main/java/server/archive/registration/FreeRegistrationCertificateV1.java');
const archive = read('SHiNE-server/shine-server-archive/src/main/java/server/archive/ArweaveBlocksConfig.java');
assert.match(ui, /SHINE_CORE_NAMESPACE\s*=\s*'SHiNE'/);
assert.match(archive, /TEST_TAG_VALUE\s*=\s*ShineProtocolTags\.CORE_NAMESPACE/);
assert.match(server, /CORE_NAMESPACE\s*=\s*"SHiNE"/);
assert.match(viewer, /SHINE_PROTOCOL_NAMESPACE\s*=\s*'SHiNE'/);
assert.match(reg, /ShineProtocolTags\.CORE_REGISTRATION_TAGS/);
for (const txt of [ui, server, viewer, reg]) assert.doesNotMatch(txt, /test5591/);
import { parseServerEnvironment } from '../js/services/server-environment.js';
import { coreTags } from '../js/services/core-content.js';
const read = p => fs.readFileSync(new URL('../../'+p, import.meta.url), 'utf8');
test('GetServerInfo: strict environment tuple; absent or inconsistent mode cannot sign', () => {
for (const [testMode,arweaveAppTag,solanaCluster] of [[true,'test5570','devnet'],[false,'SHiNE','mainnet-beta']]) {
const env = parseServerEnvironment({status:200,payload:{testMode,arweaveAppTag,solanaCluster}});
assert.equal(coreTags({blockNumber:0},env.arweaveAppTag)[0].value, arweaveAppTag);
assert.throws(()=>parseServerEnvironment({status:200,payload:{testMode,arweaveAppTag:'test5599',solanaCluster}}));
assert.throws(()=>parseServerEnvironment({status:200,payload:{testMode:!testMode,arweaveAppTag,solanaCluster}}));
}
assert.throws(()=>parseServerEnvironment({status:200,payload:{solanaCluster:'mainnet-beta'}}));
assert.throws(()=>coreTags({blockNumber:0}));
assert.throws(()=>coreTags({blockNumber:0},'test5599'));
});
test('Server/Viewer/ESP32 use the current independent namespaces', () => {
const server=read('SHiNE-server/shine-server-config/src/main/java/utils/config/ServerEnvironment.java');
const viewer=read('shine-UI/static-sites/arweave-viewer/index.html');
const esp=read('ESP32/esp32/ESP32-S3-Touch-AMOLED-2.16/main-device/shine_registration_signer/certificate_v1.h');
assert.match(server,/PRODUCTION_APP = "SHiNE"/); assert.match(server,/TEST_APP = "test5570"/);
assert.match(viewer,/\[SHINE_ARWEAVE_APP_TAG\]/); assert.doesNotMatch(viewer,/test5599/);
assert.match(esp,/avroString\(a,"SHiNE"\)/);
});