Refractoring Stage 5 Completed the IPC feature-grouping step.

This commit is contained in:
2026-10-16 18:07:16 +03:00
parent 52f7001b34
commit 0737892766
8 changed files with 560 additions and 373 deletions
+34
View File
@@ -0,0 +1,34 @@
const test = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const path = require('node:path');
const root = path.resolve(__dirname, '..');
const packageJson = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
const packageLock = JSON.parse(fs.readFileSync(path.join(root, 'package-lock.json'), 'utf8'));
const androidBuild = fs.readFileSync(path.join(root, 'android', 'app', 'build.gradle'), 'utf8');
const buildAll = fs.readFileSync(path.join(root, 'scripts', 'build-all.ps1'), 'utf8');
const desktopWorkflow = fs.readFileSync(path.join(root, '.github', 'workflows', 'desktop-build.yml'), 'utf8');
test('package metadata and lockfile share one release version', () => {
assert.equal(packageLock.version, packageJson.version);
assert.equal(packageLock.packages[''].version, packageJson.version);
assert.match(packageJson.version, /^\d+\.\d+\.\d+$/);
});
test('Android version name and code derive from the canonical package version', () => {
assert.match(androidBuild, /parse\(file\("\.\.\/\.\.\/package\.json"\)\)\.version/);
assert.match(androidBuild, /versionName appVersion/);
assert.match(androidBuild, /versionCode appVersionParts\[0\] \* 10000 \+ appVersionParts\[1\] \* 100 \+ appVersionParts\[2\]/);
const parts = packageJson.version.split('.').map(Number);
const expectedCode = parts[0] * 10000 + parts[1] * 100 + parts[2];
assert.ok(Number.isSafeInteger(expectedCode) && expectedCode > 0);
assert.ok(parts[1] < 100 && parts[2] < 100, 'update the Android versionCode mapping before minor or patch reaches 100');
});
test('release scripts and desktop artifact labels use package.json version', () => {
assert.match(buildAll, /package\.json/);
assert.match(desktopWorkflow, /require\('\.\/package\.json'\)\.version/);
assert.match(desktopWorkflow, /-v\$\{\{ steps\.app-version\.outputs\.version \}\}/);
});