Format authored monorepo code with pinned language formatters
This commit is contained in:
+20
-8
@@ -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" }]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user