Skip to content

Commit 43bb827

Browse files
authored
Restack journal migration #1376 on main (#1376)
1 parent 8ca7e83 commit 43bb827

3 files changed

Lines changed: 76 additions & 21 deletions

File tree

‎packages/core/tests/declared-markdown-component.test.ts‎

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -654,8 +654,18 @@ describe("Tier DM — the name is claimed rather than offered", () => {
654654
},
655655
};
656656

657-
const undeclared = yield* run("<Virtual />\n", [], [substitute]);
658-
const declaring = yield* run("<Virtual />\n", [declared(POLICY_SOURCE)], [substitute]);
657+
const undeclared = yield* run(
658+
"<Virtual />\n",
659+
[],
660+
[substitute],
661+
yield* useJournalStream(ROOT_PATH),
662+
);
663+
const declaring = yield* run(
664+
"<Virtual />\n",
665+
[declared(POLICY_SOURCE)],
666+
[substitute],
667+
yield* useJournalStream(ROOT_PATH),
668+
);
659669

660670
expect(undeclared).toContain("the handler answered.");
661671
expect(declaring).toEqual(undeclared);
@@ -689,6 +699,7 @@ describe("Tier DM — the name is claimed rather than offered", () => {
689699
},
690700
},
691701
],
702+
yield* useJournalStream(ROOT_PATH),
692703
),
693704
);
694705

@@ -1956,6 +1967,8 @@ function* refusedBy(operation: Operation<unknown>): Operation<Error> {
19561967
}
19571968

19581969
describe("Tier MDK — the declaration states its kind", () => {
1970+
beforeEach(journalBeforeEach(OWNER));
1971+
19591972
// deno-lint-ignore require-yield
19601973
it("MDK1: the constructor states the kind and changes nothing else", function* () {
19611974
const props: PropsSchema = { type: "object", properties: {}, additionalProperties: false };
@@ -2009,7 +2022,9 @@ describe("Tier MDK — the declaration states its kind", () => {
20092022
const declarations = [declared(POLICY_SOURCE)];
20102023

20112024
// Selection and expansion.
2012-
expect(String(yield* run("<Policy />\n", declarations))).toContain("The policy ran.");
2025+
expect(
2026+
String(yield* run("<Policy />\n", declarations, [], yield* useJournalStream(ROOT_PATH))),
2027+
).toContain("The policy ran.");
20132028

20142029
// Inspection reports the same declared contract.
20152030
const info = yield* inspectComponent({ name: "Policy", includes: [], declarations });
@@ -2030,10 +2045,14 @@ describe("Tier MDK — the declaration states its kind", () => {
20302045

20312046
// And the private closure still resolves only inside the declaring bytes.
20322047
const withPrivate = [declared(WITH_PRIVATE, { privates: [secret()] })];
2033-
expect(String(yield* run("<Policy />\n", withPrivate))).toContain("policy says");
2034-
expect(yield* refusal(run('<Secret as="answer" />\n', withPrivate))).toContain(
2035-
"Cannot resolve component: Secret",
2036-
);
2048+
expect(
2049+
String(yield* run("<Policy />\n", withPrivate, [], yield* useJournalStream(ROOT_PATH))),
2050+
).toContain("policy says");
2051+
expect(
2052+
yield* refusal(
2053+
run('<Secret as="answer" />\n', withPrivate, [], yield* useJournalStream(ROOT_PATH)),
2054+
),
2055+
).toContain("Cannot resolve component: Secret");
20372056
});
20382057

20392058
it("MDK2: the kind is what admission reads first, before any other member", function* () {
@@ -2482,13 +2501,20 @@ describe("Tier ED — one catalog, two arms", () => {
24822501
const root = yield* workspace({ "Deck.md": "The repository file ran.\n" });
24832502
const repository = yield* inspectComponent({ name: "Deck", includes: [root] });
24842503
expect(repository.kind).toBe("markdown");
2485-
expect(String(yield* run("<Deck />\n", [], [], new InMemoryStream(), [root]))).toContain(
2486-
"The repository file ran.",
2487-
);
2504+
expect(
2505+
String(yield* run("<Deck />\n", [], [], yield* useJournalStream(ROOT_PATH), [root])),
2506+
).toContain("The repository file ran.");
24882507

24892508
// And the engine's own structural behavior is what it always was.
24902509
expect(
2491-
String(yield* run("<If condition={true}>branch taken</If>\n", [], [], new InMemoryStream())),
2510+
String(
2511+
yield* run(
2512+
"<If condition={true}>branch taken</If>\n",
2513+
[],
2514+
[],
2515+
yield* useJournalStream(ROOT_PATH),
2516+
),
2517+
),
24922518
).toContain("branch taken");
24932519
});
24942520
});

‎packages/core/tests/evaluate-component.test.ts‎

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ describe("protected generated component answers", () => {
248248

249249
it("keeps the producer's route while the generated child admits only Syntax", function* () {
250250
const told: string[] = [];
251-
const stream = new InMemoryStream();
251+
const stream = yield* useJournalStream(ROOT_PATH);
252252
yield* scoped(function* () {
253253
yield* registerComponents([
254254
{
@@ -286,7 +286,13 @@ describe("protected generated component answers", () => {
286286
});
287287
for (const text of ["<Producer />", "<Evaluate text='inert' />", "<File path='x' />"]) {
288288
expect(
289-
yield* refusal(run(`<Evaluate text={${JSON.stringify(text)}} />`, [syntaxProfile()])),
289+
yield* refusal(
290+
run(
291+
`<Evaluate text={${JSON.stringify(text)}} />`,
292+
[syntaxProfile()],
293+
yield* useJournalStream(ROOT_PATH),
294+
),
295+
),
290296
).toContain("did not admit");
291297
}
292298
});
@@ -1550,7 +1556,11 @@ describe("Tier FE35 — structural constructs in a generated fragment", () => {
15501556
];
15511557
for (const [fragment, expected] of cases) {
15521558
const failed = yield* refusal(
1553-
run(`<Evaluate text={'${fragment}'} allow={["read"]} />\n`, [reading(files)]),
1559+
run(
1560+
`<Evaluate text={'${fragment}'} allow={["read"]} />\n`,
1561+
[reading(files)],
1562+
yield* useJournalStream(ROOT_PATH),
1563+
),
15541564
);
15551565
expect(failed).toContain(expected);
15561566
}
@@ -1578,7 +1588,11 @@ describe("Tier FE35 — structural constructs in a generated fragment", () => {
15781588
];
15791589
for (const fragment of cases) {
15801590
const failed = yield* refusal(
1581-
run(`<Evaluate text={'${fragment}'} allow={["read"]} />\n`, [reading(files)]),
1591+
run(
1592+
`<Evaluate text={'${fragment}'} allow={["read"]} />\n`,
1593+
[reading(files)],
1594+
yield* useJournalStream(ROOT_PATH),
1595+
),
15821596
);
15831597
expect(failed).toContain("declarative data");
15841598
}
@@ -1610,6 +1624,7 @@ describe("Tier FE35 — structural constructs in a generated fragment", () => {
16101624
run(
16111625
`<Evaluate text={'<Each in={["a"]} let="item">\\nx\\n</Each>\\n<Json value={item} />\\n'} />\n`,
16121626
[reading(files)],
1627+
yield* useJournalStream(ROOT_PATH),
16131628
),
16141629
);
16151630
expect(leaked).toContain("declarative data");
@@ -1619,6 +1634,7 @@ describe("Tier FE35 — structural constructs in a generated fragment", () => {
16191634
`<Evaluate text={'<Each in={["a"]} let="item" as="all">\\nx\\n</Each>\\n` +
16201635
`<Json value={all} />\\n'} as="answer" />\n\n<Json value={answer} />\n`,
16211636
[reading(files)],
1637+
yield* useJournalStream(ROOT_PATH),
16221638
);
16231639
expect(String(captured)).toContain("x");
16241640
expect(files.performed).toEqual([]);
@@ -1644,7 +1660,11 @@ describe("Tier FE35 — structural constructs in a generated fragment", () => {
16441660
];
16451661
for (const [fragment, expected] of cases) {
16461662
const failed = yield* refusal(
1647-
run(`<Evaluate text={'${fragment}'} allow={["read"]} />\n`, [reading(files)]),
1663+
run(
1664+
`<Evaluate text={'${fragment}'} allow={["read"]} />\n`,
1665+
[reading(files)],
1666+
yield* useJournalStream(ROOT_PATH),
1667+
),
16481668
);
16491669
expect(failed).toContain(expected);
16501670
}
@@ -1660,6 +1680,7 @@ describe("Tier FE35 — structural constructs in a generated fragment", () => {
16601680
`<Evaluate text={'<Loop max={2}>\\n<Dir path="d">\\n<Break />\\n</Dir>\\n</Loop>\\n'} ` +
16611681
`allow={["write"]} />\n`,
16621682
[both(writable)],
1683+
yield* useJournalStream(ROOT_PATH),
16631684
),
16641685
);
16651686
expect(stray).toContain("structural construct");
@@ -1733,7 +1754,11 @@ describe("Tier FE35 — structural constructs in a generated fragment", () => {
17331754
];
17341755
for (const [body, expected] of cases) {
17351756
const failed = yield* refusal(
1736-
run(`<Evaluate text={'<If condition={true}>\\n${body}\\n</If>\\n'} />\n`, [reading(files)]),
1757+
run(
1758+
`<Evaluate text={'<If condition={true}>\\n${body}\\n</If>\\n'} />\n`,
1759+
[reading(files)],
1760+
yield* useJournalStream(ROOT_PATH),
1761+
),
17371762
);
17381763
expect(failed).toContain(expected);
17391764
}

‎packages/core/tests/syntax-component.test.ts‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ describe("Tier SYN — the named form", () => {
849849
scoped(function* () {
850850
yield* useMarkerDocumentation({ supplies: ["Marker", "Other"], text: PAIR_PROSE });
851851
yield* useMarkerDocumentation({ supplies: ["Other", "Marker"], text: PAIR_PROSE });
852-
return yield* run(source, [marker]);
852+
return yield* run(source, [marker], yield* useJournalStream(ROOT_PATH));
853853
});
854854

855855
// Named, bare, and a document that writes no `<Syntax>` at all. Collection
@@ -893,7 +893,7 @@ describe("Tier SYN — the named form", () => {
893893
yield* useMarkerDocumentation(reversed ? {} : changed);
894894
// No `<Syntax>` at all: the refusal is the execution's, before its
895895
// root ran, not something an occurrence discovered.
896-
return yield* run("nothing here\n", [marker]);
896+
return yield* run("nothing here\n", [marker], yield* useJournalStream(ROOT_PATH));
897897
}),
898898
);
899899
expect([
@@ -950,15 +950,19 @@ describe("Tier SYN — the named form", () => {
950950
scoped(function* () {
951951
yield* useMarkerDocumentation();
952952
yield* useMarkerDocumentation({ text: "## Marker\n\nCONFLICTING.\n" });
953-
return yield* run("nothing here\n", [marker]);
953+
return yield* run("nothing here\n", [marker], yield* useJournalStream(ROOT_PATH));
954954
}),
955955
),
956956
);
957957

958958
const beside = String(
959959
yield* scoped(function* () {
960960
yield* useMarkerDocumentation();
961-
return yield* run('<Syntax names={["Marker"]} />\n', [marker]);
961+
return yield* run(
962+
'<Syntax names={["Marker"]} />\n',
963+
[marker],
964+
yield* useJournalStream(ROOT_PATH),
965+
);
962966
}),
963967
);
964968
expect(beside).toContain("MARKER PROSE.");

0 commit comments

Comments
 (0)