T01.i: remove dead ensureReposOpen (batch open-repo helper)

Its only callers were its own definition and its dedicated test block;
no production code used it since the read-union removal (T01.f). The
one test that exercised readDocumentSubjects' real integration path
(not ensureReposOpen itself) is kept, moved under the ensureRepoOpen
describe block it actually belongs to.
This commit is contained in:
Sylvain Duchesne
2026-09-21 14:35:32 +02:00
parent d62d23c686
commit 51b6278bf6
2 changed files with 2 additions and 51 deletions
+2 -40
View File
@@ -1,6 +1,5 @@
/**
* open-repo.test.ts — behavioral tests for ensureRepoOpen / ensureReposOpen
* (src/open-repo.ts).
* open-repo.test.ts — behavioral tests for ensureRepoOpen (src/open-repo.ts).
*
* Core invariant: on a fresh session over a persistent wallet, a scope-index
* or entity repo is NOT yet in `self.repos`, so an anchored sparql_query returns
@@ -21,7 +20,7 @@
*/
import { describe, it, expect, mock, beforeEach, afterAll } from "bun:test";
import { ensureRepoOpen, ensureReposOpen, resetOpenedRepos } from "../src/emulated-verifier/open-repo";
import { ensureRepoOpen, resetOpenedRepos } from "../src/emulated-verifier/open-repo";
import { readDocumentSubjects } from "../src/surface/read-document";
import { configure } from "../src/index";
import { configureStoreRegistry, setCurrentUser } from "../src/shared-wallet/bootstrap";
@@ -168,43 +167,6 @@ describe("ensureRepoOpen", () => {
// Calling again should also be a no-op (idempotent, already in opened)
await expect(ensureRepoOpen("did:ng:o:c")).resolves.toBeUndefined();
});
});
describe("ensureReposOpen", () => {
it("opens all provided nuris in parallel (one subscribe per unique nuri)", async () => {
const ng = makeFakeNgWithSubscribe({
"did:ng:o:x": [[TYPE, `${FP}Event`]],
"did:ng:o:y": [[TYPE, `${FP}Event`]],
});
inject(ng);
await ensureReposOpen(["did:ng:o:x", "did:ng:o:y"]);
expect(ng.doc_subscribe).toHaveBeenCalledTimes(2);
expect(ng.subscribed.has("did:ng:o:x")).toBe(true);
expect(ng.subscribed.has("did:ng:o:y")).toBe(true);
});
it("deduplicates: repeated nuri in input leads to exactly one subscribe", async () => {
const ng = makeFakeNgWithSubscribe({
"did:ng:o:dup": [[TYPE, `${FP}Event`]],
});
inject(ng);
await ensureReposOpen(["did:ng:o:dup", "did:ng:o:dup", "did:ng:o:dup"]);
expect(ng.doc_subscribe).toHaveBeenCalledTimes(1);
});
it("empty or all-falsy input is a no-op (no subscribe calls)", async () => {
const ng = makeFakeNgWithSubscribe({});
inject(ng);
await ensureReposOpen([]);
await ensureReposOpen(["" as any]);
expect(ng.doc_subscribe).toHaveBeenCalledTimes(0);
});
it("the anchored document read triggers doc_subscribe then returns data (integration path)", async () => {
const ng = makeFakeNgWithSubscribe({