chore: les dix injections de useShape passent par le faux partage

Dix sites, pas les deux que le suivi annoncait : `(() => {}) as unknown as
UseShapeLike` survivait la ou le type etait encore `any` et ou le cast ne
disait donc rien. Ils prennent le faux partage, sans cast.
This commit is contained in:
Sylvain Duchesne
2026-09-24 19:00:25 +02:00
parent c5de1cea35
commit d4b392a119
6 changed files with 16 additions and 10 deletions
@@ -22,6 +22,7 @@
*/
import { describe, it, expect, mock, beforeEach, afterEach, afterAll } from "bun:test";
import { makeUseShapeHook } from "./use-shape-fake";
import { useShapeQuery } from "../src/surface/use-shape-query";
import { configure } from "../src/index";
import { configureStoreRegistry, setCurrentUser, getCaps } from "../src/shared-wallet/bootstrap";
@@ -209,7 +210,7 @@ function inject(ng: ReturnType<typeof makeFake>, orm: FakeOrm) {
if (ng._noSubscribe) delete forwarded.doc_subscribe;
configure({
ng: forwarded as unknown as NgLike,
useShape: (() => {}) as unknown as UseShapeLike,
useShape: makeUseShapeHook().hook,
ormSubscription: orm.query,
});
configureStoreRegistry({
@@ -231,7 +232,7 @@ function reconfigure(ng: ReturnType<typeof makeFake>, orm: FakeOrm): void {
if (ng._noSubscribe) delete forwarded.doc_subscribe;
configure({
ng: forwarded as unknown as NgLike,
useShape: (() => {}) as unknown as UseShapeLike,
useShape: makeUseShapeHook().hook,
ormSubscription: orm.query,
});
configureStoreRegistry({
@@ -432,7 +433,7 @@ describe("useShapeQuery", () => {
inject(ng, orm);
// ...and then a bootstrap that forgot the injection. The read has nothing to go
// through, and an empty set would be the one lie this surface exists to prevent.
configure({ ng: ng as unknown as NgLike, useShape: (() => {}) as unknown as UseShapeLike });
configure({ ng: ng as unknown as NgLike, useShape: makeUseShapeHook().hook });
configureStoreRegistry({
getSession: async () => SESSION,
normalizeId: (u: string) => u.trim().replace(/^@+/, "").toLowerCase(),