git mv packages/business -> packages/organization (@mosaic/organization). The old package stays as one-line re-export shims of each moved module, with src/business.mjs re-exporting src/organization-config.mjs and src/cli.mjs forwarding to the moved executable. BusinessError is OrganizationConfigError (one constructor, name kept BusinessError); OrganizationError stays distinct. The bus adapter gains organization-context.mjs (busOrganization), with business.mjs (busBusiness) as the same function. Import consumers, manifests, the lockfile, scripts/mosaic, stack-copy.sh COPY_PATHS (both roots), seat sandbox RUNNER_FILES and the copy closure walker (organization-imports.mjs, both roots required) move to the new path. v1 serialization, v1 writers and the stage A fixtures are unchanged; the stage A contract tests stay where they were and pass as before.
22 lines
1.6 KiB
JavaScript
22 lines
1.6 KiB
JavaScript
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { chmodSync, mkdirSync, renameSync, writeFileSync } from 'node:fs';
|
|
import { join } from 'node:path';
|
|
import { fixture, tmp } from './helpers.mjs';
|
|
import { busStart, busStop, busStopForDelete } from '../src/org-bus.mjs';
|
|
import { createOrg, deleteOrg, templateRender } from '../../organization/src/org-service.mjs';
|
|
|
|
test('deletion stops the recorded running bus before moving its runtime', { timeout: 60000 }, async t => {
|
|
const root = tmp(t, 'd-'), f = fixture(root), dir = join(root, '.config', 'mosaic-test');
|
|
mkdirSync(join(root, '.config'), { mode: 0o700 }); renameSync(join(root, 'config'), dir); chmodSync(dir, 0o700); chmodSync(join(dir, 'businesses'), 0o700);
|
|
writeFileSync(join(f.dataRoot, 'instance.json'), JSON.stringify({ instanceVersion: 1, name: 'test' }), { mode: 0o600 });
|
|
const env = { ...f.env, HOME: root, MOSAIC_CONFIG: join(dir, 'config.json') };
|
|
const ctx = { configDir: dir, dataRoot: f.dataRoot, instance: 'test', env, principal: { provider: 'local-dev', iss: 'local-dev', sub: 'local-dev-owner' } };
|
|
await createOrg(ctx, 'a', await templateRender('a'));
|
|
const started = await busStart(ctx, 'a', { detach: true, devLocalOwner: true, noLaunch: true });
|
|
t.after(async () => { try { await busStop(ctx, 'a'); } catch {} });
|
|
const receipt = await deleteOrg(ctx, 'a', { busStop: busStopForDelete, confirm: 'a', ifRevision: 1 });
|
|
assert.equal(receipt.bus.stopped, true); assert.equal(receipt.bus.pid, started.pid);
|
|
assert.ok(receipt.moves.some(move => move.from === started.root));
|
|
});
|