Format authored monorepo code with pinned language formatters

This commit is contained in:
Timothy J. Aveni
2026-09-15 15:23:24 -07:00
parent bee4452852
commit 0d3c013c07
12 changed files with 1223 additions and 674 deletions
+20 -8
View File
@@ -1,13 +1,25 @@
import test from "node:test";
import assert from "node:assert/strict";
import {createMigrationContext, migrationObjectId} from "../dist/migration.js";
import { createMigrationContext, migrationObjectId } from "../dist/migration.js";
test("migration context offers restricted ports and deterministic helper identities", () => {
const input = {schemaVersion: 1, executionId: "operation:transition", exportId: "migrate", ports: [
{name: "old", binding: "slot:name", view: "old", access: ["read"], states: [{objectId: "obj:one", value: "Alice"}]},
{name: "new", binding: "slot:name", view: "new", access: ["write"]}, {name: "newRead", binding: "slot:name", view: "new", access: ["read"]},
{name: "helpers", binding: "atom:helper", view: "new", access: ["create"]},
]};
const {context, result} = createMigrationContext(input);
const input = {
schemaVersion: 1,
executionId: "operation:transition",
exportId: "migrate",
ports: [
{
name: "old",
binding: "slot:name",
view: "old",
access: ["read"],
states: [{ objectId: "obj:one", value: "Alice" }],
},
{ name: "new", binding: "slot:name", view: "new", access: ["write"] },
{ name: "newRead", binding: "slot:name", view: "new", access: ["read"] },
{ name: "helpers", binding: "atom:helper", view: "new", access: ["create"] },
],
};
const { context, result } = createMigrationContext(input);
assert.equal(context.read("old", "obj:one"), "Alice");
assert.throws(() => context.write("old", "obj:one", "Bob"), /does not grant/);
assert.throws(() => context.read("new", "obj:one"), /does not grant/);
@@ -20,5 +32,5 @@ test("migration context offers restricted ports and deterministic helper identit
assert.equal(helper, migrationObjectId(input.executionId, "helpers", "one"));
assert.equal(context.create("helpers", "one"), helper);
assert.equal(result().creates.length, 1);
assert.deepEqual(input.ports[0].states, [{objectId: "obj:one", value: "Alice"}]);
assert.deepEqual(input.ports[0].states, [{ objectId: "obj:one", value: "Alice" }]);
});