import assert from 'node:assert/strict'; import test from 'node:test'; import { affectedComponents, bumpVersions } from '../scripts/harbor-version.mjs'; const versions = { macClient: '2.4.3', gatewayClient: '2.7.1', gatewayBackend: '2.7.8', }; test('version paths map to the components actually shipped by this repository', () => { assert.deepEqual(affectedComponents(['src/web/App.jsx']), ['macClient', 'gatewayClient']); assert.deepEqual(affectedComponents(['src/server/index.js']), ['macClient', 'gatewayBackend']); assert.deepEqual(affectedComponents(['docker-compose.client.local.yml']), ['macClient']); assert.deepEqual(affectedComponents(['install.sh']), ['macClient']); assert.deepEqual(affectedComponents(['package-lock.json']), [ 'macClient', 'gatewayClient', 'gatewayBackend', ]); assert.deepEqual(affectedComponents(['README.md', 'test/server/version.test.js']), []); }); test('version bumps follow ecosystem, linked-component and local scopes', () => { assert.deepEqual(bumpVersions(versions, 'major'), { macClient: '3.0.0', gatewayClient: '3.0.0', gatewayBackend: '3.0.0', }); assert.deepEqual(bumpVersions(versions, 'minor', ['gateway-backend']), { macClient: '2.4.3', gatewayClient: '2.8.0', gatewayBackend: '2.8.0', }); assert.deepEqual(bumpVersions(versions, 'hotfix', ['mac']), { macClient: '2.4.4', gatewayClient: '2.7.1', gatewayBackend: '2.7.8', }); });