@freqhole/reliquary 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/dist/automerge/acl-filtering.d.ts +87 -0
  2. package/dist/automerge/acl-filtering.d.ts.map +1 -0
  3. package/dist/automerge/acl-filtering.js +138 -0
  4. package/dist/automerge/acl-filtering.test.d.ts +2 -0
  5. package/dist/automerge/acl-filtering.test.d.ts.map +1 -0
  6. package/dist/automerge/acl-filtering.test.js +302 -0
  7. package/dist/automerge/index.d.ts +5 -0
  8. package/dist/automerge/index.d.ts.map +1 -0
  9. package/dist/automerge/index.js +7 -0
  10. package/dist/automerge/iroh-network-adapter.d.ts +178 -0
  11. package/dist/automerge/iroh-network-adapter.d.ts.map +1 -0
  12. package/dist/automerge/iroh-network-adapter.js +691 -0
  13. package/dist/automerge/iroh-network-adapter.test.d.ts +2 -0
  14. package/dist/automerge/iroh-network-adapter.test.d.ts.map +1 -0
  15. package/dist/automerge/iroh-network-adapter.test.js +818 -0
  16. package/dist/automerge/types.d.ts +66 -0
  17. package/dist/automerge/types.d.ts.map +1 -0
  18. package/dist/automerge/types.js +10 -0
  19. package/dist/blobs/bytes-backend.d.ts +41 -0
  20. package/dist/blobs/bytes-backend.d.ts.map +1 -0
  21. package/dist/blobs/bytes-backend.js +252 -0
  22. package/dist/blobs/bytes-backend.test.d.ts +2 -0
  23. package/dist/blobs/bytes-backend.test.d.ts.map +1 -0
  24. package/dist/blobs/bytes-backend.test.js +241 -0
  25. package/dist/blobs/db.d.ts +8 -0
  26. package/dist/blobs/db.d.ts.map +1 -0
  27. package/dist/blobs/db.js +141 -0
  28. package/dist/blobs/db.test.d.ts +2 -0
  29. package/dist/blobs/db.test.d.ts.map +1 -0
  30. package/dist/blobs/db.test.js +120 -0
  31. package/dist/blobs/index.d.ts +5 -0
  32. package/dist/blobs/index.d.ts.map +1 -0
  33. package/dist/blobs/index.js +2 -0
  34. package/dist/blobs/store.d.ts +47 -0
  35. package/dist/blobs/store.d.ts.map +1 -0
  36. package/dist/blobs/store.js +263 -0
  37. package/dist/blobs/store.test.d.ts +2 -0
  38. package/dist/blobs/store.test.d.ts.map +1 -0
  39. package/dist/blobs/store.test.js +377 -0
  40. package/dist/blobs/types.d.ts +55 -0
  41. package/dist/blobs/types.d.ts.map +1 -0
  42. package/dist/blobs/types.js +8 -0
  43. package/dist/ensure/client.d.ts +19 -0
  44. package/dist/ensure/client.d.ts.map +1 -0
  45. package/dist/ensure/client.js +74 -0
  46. package/dist/ensure/client.test.d.ts +2 -0
  47. package/dist/ensure/client.test.d.ts.map +1 -0
  48. package/dist/ensure/client.test.js +133 -0
  49. package/dist/ensure/index.d.ts +4 -0
  50. package/dist/ensure/index.d.ts.map +1 -0
  51. package/dist/ensure/index.js +4 -0
  52. package/dist/ensure/responder.d.ts +20 -0
  53. package/dist/ensure/responder.d.ts.map +1 -0
  54. package/dist/ensure/responder.js +100 -0
  55. package/dist/ensure/responder.test.d.ts +2 -0
  56. package/dist/ensure/responder.test.d.ts.map +1 -0
  57. package/dist/ensure/responder.test.js +191 -0
  58. package/dist/ensure/types.d.ts +19 -0
  59. package/dist/ensure/types.d.ts.map +1 -0
  60. package/dist/ensure/types.js +4 -0
  61. package/dist/ensure/types.test.d.ts +2 -0
  62. package/dist/ensure/types.test.d.ts.map +1 -0
  63. package/dist/ensure/types.test.js +81 -0
  64. package/dist/index.d.ts +2 -0
  65. package/dist/index.d.ts.map +1 -0
  66. package/dist/index.js +3 -0
  67. package/dist/index.test.d.ts +2 -0
  68. package/dist/index.test.d.ts.map +1 -0
  69. package/dist/index.test.js +7 -0
  70. package/dist/solid/blob-url.d.ts +10 -0
  71. package/dist/solid/blob-url.d.ts.map +1 -0
  72. package/dist/solid/blob-url.js +34 -0
  73. package/dist/solid/blob-url.test.d.ts +2 -0
  74. package/dist/solid/blob-url.test.d.ts.map +1 -0
  75. package/dist/solid/blob-url.test.js +62 -0
  76. package/dist/solid/connection-summary.d.ts +25 -0
  77. package/dist/solid/connection-summary.d.ts.map +1 -0
  78. package/dist/solid/connection-summary.js +29 -0
  79. package/dist/solid/connection-summary.test.d.ts +2 -0
  80. package/dist/solid/connection-summary.test.d.ts.map +1 -0
  81. package/dist/solid/connection-summary.test.js +57 -0
  82. package/dist/solid/doc-store.d.ts +29 -0
  83. package/dist/solid/doc-store.d.ts.map +1 -0
  84. package/dist/solid/doc-store.js +79 -0
  85. package/dist/solid/doc-store.test.d.ts +2 -0
  86. package/dist/solid/doc-store.test.d.ts.map +1 -0
  87. package/dist/solid/doc-store.test.js +234 -0
  88. package/dist/solid/index.d.ts +4 -0
  89. package/dist/solid/index.d.ts.map +1 -0
  90. package/dist/solid/index.js +9 -0
  91. package/dist/solid/transfer-progress.d.ts +21 -0
  92. package/dist/solid/transfer-progress.d.ts.map +1 -0
  93. package/dist/solid/transfer-progress.js +32 -0
  94. package/dist/solid/transfer-progress.test.d.ts +2 -0
  95. package/dist/solid/transfer-progress.test.d.ts.map +1 -0
  96. package/dist/solid/transfer-progress.test.js +76 -0
  97. package/dist/testing/blob-fixtures.d.ts +19 -0
  98. package/dist/testing/blob-fixtures.d.ts.map +1 -0
  99. package/dist/testing/blob-fixtures.js +46 -0
  100. package/dist/testing/blob-fixtures.test.d.ts +2 -0
  101. package/dist/testing/blob-fixtures.test.d.ts.map +1 -0
  102. package/dist/testing/blob-fixtures.test.js +46 -0
  103. package/dist/testing/idb-harness.d.ts +10 -0
  104. package/dist/testing/idb-harness.d.ts.map +1 -0
  105. package/dist/testing/idb-harness.js +17 -0
  106. package/dist/testing/idb-harness.test.d.ts +2 -0
  107. package/dist/testing/idb-harness.test.d.ts.map +1 -0
  108. package/dist/testing/idb-harness.test.js +48 -0
  109. package/dist/testing/index.d.ts +7 -0
  110. package/dist/testing/index.d.ts.map +1 -0
  111. package/dist/testing/index.js +11 -0
  112. package/dist/testing/media.d.ts +15 -0
  113. package/dist/testing/media.d.ts.map +1 -0
  114. package/dist/testing/media.js +37 -0
  115. package/dist/testing/media.test.d.ts +2 -0
  116. package/dist/testing/media.test.d.ts.map +1 -0
  117. package/dist/testing/media.test.js +47 -0
  118. package/dist/testing/mock-blob-fetch.d.ts +33 -0
  119. package/dist/testing/mock-blob-fetch.d.ts.map +1 -0
  120. package/dist/testing/mock-blob-fetch.js +39 -0
  121. package/dist/testing/mock-blob-fetch.test.d.ts +2 -0
  122. package/dist/testing/mock-blob-fetch.test.d.ts.map +1 -0
  123. package/dist/testing/mock-blob-fetch.test.js +65 -0
  124. package/dist/testing/mock-node.d.ts +36 -0
  125. package/dist/testing/mock-node.d.ts.map +1 -0
  126. package/dist/testing/mock-node.js +97 -0
  127. package/dist/testing/mock-node.test.d.ts +2 -0
  128. package/dist/testing/mock-node.test.d.ts.map +1 -0
  129. package/dist/testing/mock-node.test.js +66 -0
  130. package/dist/testing/streams.d.ts +68 -0
  131. package/dist/testing/streams.d.ts.map +1 -0
  132. package/dist/testing/streams.js +99 -0
  133. package/dist/testing/streams.test.d.ts +2 -0
  134. package/dist/testing/streams.test.d.ts.map +1 -0
  135. package/dist/testing/streams.test.js +82 -0
  136. package/dist/transfer/cancellation.d.ts +8 -0
  137. package/dist/transfer/cancellation.d.ts.map +1 -0
  138. package/dist/transfer/cancellation.js +19 -0
  139. package/dist/transfer/index.d.ts +8 -0
  140. package/dist/transfer/index.d.ts.map +1 -0
  141. package/dist/transfer/index.js +4 -0
  142. package/dist/transfer/prefetch.d.ts +38 -0
  143. package/dist/transfer/prefetch.d.ts.map +1 -0
  144. package/dist/transfer/prefetch.js +61 -0
  145. package/dist/transfer/prefetch.test.d.ts +2 -0
  146. package/dist/transfer/prefetch.test.d.ts.map +1 -0
  147. package/dist/transfer/prefetch.test.js +136 -0
  148. package/dist/transfer/serve.d.ts +66 -0
  149. package/dist/transfer/serve.d.ts.map +1 -0
  150. package/dist/transfer/serve.js +126 -0
  151. package/dist/transfer/serve.test.d.ts +2 -0
  152. package/dist/transfer/serve.test.d.ts.map +1 -0
  153. package/dist/transfer/serve.test.js +101 -0
  154. package/dist/transfer/snatch.d.ts +39 -0
  155. package/dist/transfer/snatch.d.ts.map +1 -0
  156. package/dist/transfer/snatch.js +289 -0
  157. package/dist/transfer/snatch.test.d.ts +2 -0
  158. package/dist/transfer/snatch.test.d.ts.map +1 -0
  159. package/dist/transfer/snatch.test.js +337 -0
  160. package/dist/transfer/types.d.ts +85 -0
  161. package/dist/transfer/types.d.ts.map +1 -0
  162. package/dist/transfer/types.js +15 -0
  163. package/dist/utils/hash.d.ts +13 -0
  164. package/dist/utils/hash.d.ts.map +1 -0
  165. package/dist/utils/hash.js +31 -0
  166. package/dist/utils/hash.test.d.ts +2 -0
  167. package/dist/utils/hash.test.d.ts.map +1 -0
  168. package/dist/utils/hash.test.js +56 -0
  169. package/dist/utils/image-utils.d.ts +28 -0
  170. package/dist/utils/image-utils.d.ts.map +1 -0
  171. package/dist/utils/image-utils.js +113 -0
  172. package/dist/utils/image-utils.test.d.ts +2 -0
  173. package/dist/utils/image-utils.test.d.ts.map +1 -0
  174. package/dist/utils/image-utils.test.js +181 -0
  175. package/dist/utils/index.d.ts +4 -0
  176. package/dist/utils/index.d.ts.map +1 -0
  177. package/dist/utils/index.js +3 -0
  178. package/dist/utils/log.d.ts +22 -0
  179. package/dist/utils/log.d.ts.map +1 -0
  180. package/dist/utils/log.js +100 -0
  181. package/dist/utils/log.test.d.ts +2 -0
  182. package/dist/utils/log.test.d.ts.map +1 -0
  183. package/dist/utils/log.test.js +113 -0
  184. package/dist/worker/blob-worker-client.d.ts +118 -0
  185. package/dist/worker/blob-worker-client.d.ts.map +1 -0
  186. package/dist/worker/blob-worker-client.js +361 -0
  187. package/dist/worker/blob-worker-client.test.d.ts +2 -0
  188. package/dist/worker/blob-worker-client.test.d.ts.map +1 -0
  189. package/dist/worker/blob-worker-client.test.js +137 -0
  190. package/dist/worker/blob-worker-logic.d.ts +120 -0
  191. package/dist/worker/blob-worker-logic.d.ts.map +1 -0
  192. package/dist/worker/blob-worker-logic.js +368 -0
  193. package/dist/worker/blob-worker-logic.test.d.ts +2 -0
  194. package/dist/worker/blob-worker-logic.test.d.ts.map +1 -0
  195. package/dist/worker/blob-worker-logic.test.js +191 -0
  196. package/dist/worker/blob-worker.d.ts +21 -0
  197. package/dist/worker/blob-worker.d.ts.map +1 -0
  198. package/dist/worker/blob-worker.js +44 -0
  199. package/dist/worker/index.d.ts +12 -0
  200. package/dist/worker/index.d.ts.map +1 -0
  201. package/dist/worker/index.js +6 -0
  202. package/dist/worker/midden-blake3.d.ts +23 -0
  203. package/dist/worker/midden-blake3.d.ts.map +1 -0
  204. package/dist/worker/midden-blake3.js +47 -0
  205. package/dist/worker/midden-blake3.test.d.ts +2 -0
  206. package/dist/worker/midden-blake3.test.d.ts.map +1 -0
  207. package/dist/worker/midden-blake3.test.js +25 -0
  208. package/dist/worker/midden-not-bundled.stub.d.ts +1 -0
  209. package/dist/worker/midden-not-bundled.stub.d.ts.map +1 -0
  210. package/dist/worker/midden-not-bundled.stub.js +10 -0
  211. package/dist/worker/midden-stub.d.ts +10 -0
  212. package/dist/worker/midden-stub.d.ts.map +1 -0
  213. package/dist/worker/midden-stub.js +31 -0
  214. package/dist/worker/midden-stub.test.d.ts +2 -0
  215. package/dist/worker/midden-stub.test.d.ts.map +1 -0
  216. package/dist/worker/midden-stub.test.js +25 -0
  217. package/dist/worker/midden-worker-client.d.ts +103 -0
  218. package/dist/worker/midden-worker-client.d.ts.map +1 -0
  219. package/dist/worker/midden-worker-client.js +246 -0
  220. package/dist/worker/midden-worker-client.test.d.ts +2 -0
  221. package/dist/worker/midden-worker-client.test.d.ts.map +1 -0
  222. package/dist/worker/midden-worker-client.test.js +151 -0
  223. package/dist/worker/midden-worker-contract.d.ts +87 -0
  224. package/dist/worker/midden-worker-contract.d.ts.map +1 -0
  225. package/dist/worker/midden-worker-contract.js +30 -0
  226. package/package.json +90 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transfer-progress.test.d.ts","sourceRoot":"","sources":["../../src/solid/transfer-progress.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,76 @@
1
+ import { createEffect, createRoot } from "solid-js";
2
+ import { describe, expect, it } from "vitest";
3
+ import { createTransferProgress } from "./transfer-progress.js";
4
+ describe("createTransferProgress", () => {
5
+ it("starts with an empty map", () => {
6
+ createRoot((dispose) => {
7
+ const { states } = createTransferProgress();
8
+ expect(states().size).toBe(0);
9
+ dispose();
10
+ });
11
+ });
12
+ it("setState adds a key without replacing untouched entries", () => {
13
+ createRoot((dispose) => {
14
+ const { states, setState } = createTransferProgress();
15
+ setState("a", "downloading");
16
+ setState("b", "pending");
17
+ expect(states().get("a")).toBe("downloading");
18
+ expect(states().get("b")).toBe("pending");
19
+ expect(states().size).toBe(2);
20
+ dispose();
21
+ });
22
+ });
23
+ it("setState overwrites an existing key's state", () => {
24
+ createRoot((dispose) => {
25
+ const { states, setState } = createTransferProgress();
26
+ setState("a", "downloading");
27
+ setState("a", "error");
28
+ expect(states().get("a")).toBe("error");
29
+ expect(states().size).toBe(1);
30
+ dispose();
31
+ });
32
+ });
33
+ it("setState(key, null) removes the key", () => {
34
+ createRoot((dispose) => {
35
+ const { states, setState } = createTransferProgress();
36
+ setState("a", "downloading");
37
+ setState("a", null);
38
+ expect(states().has("a")).toBe(false);
39
+ dispose();
40
+ });
41
+ });
42
+ it("reset clears every tracked key", () => {
43
+ createRoot((dispose) => {
44
+ const { states, setState, reset } = createTransferProgress();
45
+ setState("a", "downloading");
46
+ setState("b", "pending");
47
+ reset();
48
+ expect(states().size).toBe(0);
49
+ dispose();
50
+ });
51
+ });
52
+ it("an effect reading states() re-runs after each setState call", async () => {
53
+ let runs = 0;
54
+ let dispose = () => { };
55
+ let setState;
56
+ createRoot((d) => {
57
+ dispose = d;
58
+ const progress = createTransferProgress();
59
+ setState = progress.setState;
60
+ createEffect(() => {
61
+ progress.states();
62
+ runs++;
63
+ });
64
+ });
65
+ // the initial effect run is flushed on the next microtask
66
+ await Promise.resolve();
67
+ expect(runs).toBe(1);
68
+ setState("a", "downloading");
69
+ await Promise.resolve();
70
+ expect(runs).toBe(2);
71
+ setState("a", "error");
72
+ await Promise.resolve();
73
+ expect(runs).toBe(3);
74
+ dispose();
75
+ });
76
+ });
@@ -0,0 +1,19 @@
1
+ /** default size for content meant to exercise real chunked transfer - a
2
+ * few multiples of a 16KiB chunk group, small enough to keep test
3
+ * runtime reasonable. */
4
+ export declare const DEFAULT_RANDOM_BLOB_SIZE: number;
5
+ /**
6
+ * deterministic pseudo-random bytes (mulberry32 PRNG, seeded) -
7
+ * reproducible across runs (a failing test always fails on the exact
8
+ * same content, instead of a new random blob every run making failures
9
+ * harder to correlate/reproduce), but realistic enough (non-repeating, no
10
+ * long runs of the same byte) to exercise real chunk/BAO-tree code paths
11
+ * the way genuinely random file content would.
12
+ */
13
+ export declare function deterministicBytes(sizeBytes: number, seed?: number): Uint8Array;
14
+ /** genuinely random bytes (node `crypto.randomBytes`) - used where
15
+ * cross-run reproducibility matters less than being sure there's no
16
+ * accidental structure a bug could hide behind (e.g. verifying a
17
+ * byte-for-byte disk write independent of any PRNG's own patterns). */
18
+ export declare function randomBlobBytes(sizeBytes?: number): Uint8Array;
19
+ //# sourceMappingURL=blob-fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blob-fixtures.d.ts","sourceRoot":"","sources":["../../src/testing/blob-fixtures.ts"],"names":[],"mappings":"AAcA;;0BAE0B;AAC1B,eAAO,MAAM,wBAAwB,QAAY,CAAC;AAElD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,SAAW,GAAG,UAAU,CAejF;AAED;;;wEAGwE;AACxE,wBAAgB,eAAe,CAAC,SAAS,GAAE,MAAiC,GAAG,UAAU,CAExF"}
@@ -0,0 +1,46 @@
1
+ // test content for blob-transfer coverage, sized to actually exercise
2
+ // chunked/verified transfer instead of false-greening on a tiny payload.
3
+ //
4
+ // a short ascii marker string is enough to prove a hash/transfer
5
+ // round-trips *a* value, but it never exercises anything past a
6
+ // transport's first chunk group (iroh-blobs' BAO tree groups chunks in
7
+ // 16KiB units by default) - every real file a user ever transfers
8
+ // (images, audio, arbitrary files) is orders of magnitude bigger than a
9
+ // short sentence, so a bug that only shows up past the first chunk (a bad
10
+ // chunk-range request, a truncated multi-round download, an off-by-one at
11
+ // a tail chunk) would never be caught by marker-string content alone.
12
+ import { randomBytes as nodeRandomBytes } from "node:crypto";
13
+ /** default size for content meant to exercise real chunked transfer - a
14
+ * few multiples of a 16KiB chunk group, small enough to keep test
15
+ * runtime reasonable. */
16
+ export const DEFAULT_RANDOM_BLOB_SIZE = 96 * 1024; // 96 KiB
17
+ /**
18
+ * deterministic pseudo-random bytes (mulberry32 PRNG, seeded) -
19
+ * reproducible across runs (a failing test always fails on the exact
20
+ * same content, instead of a new random blob every run making failures
21
+ * harder to correlate/reproduce), but realistic enough (non-repeating, no
22
+ * long runs of the same byte) to exercise real chunk/BAO-tree code paths
23
+ * the way genuinely random file content would.
24
+ */
25
+ export function deterministicBytes(sizeBytes, seed = 0xc0ffee) {
26
+ let state = seed >>> 0;
27
+ const next = () => {
28
+ state |= 0;
29
+ state = (state + 0x6d2b79f5) | 0;
30
+ let t = Math.imul(state ^ (state >>> 15), 1 | state);
31
+ t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
32
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
33
+ };
34
+ const bytes = new Uint8Array(sizeBytes);
35
+ for (let i = 0; i < sizeBytes; i++) {
36
+ bytes[i] = Math.floor(next() * 256);
37
+ }
38
+ return bytes;
39
+ }
40
+ /** genuinely random bytes (node `crypto.randomBytes`) - used where
41
+ * cross-run reproducibility matters less than being sure there's no
42
+ * accidental structure a bug could hide behind (e.g. verifying a
43
+ * byte-for-byte disk write independent of any PRNG's own patterns). */
44
+ export function randomBlobBytes(sizeBytes = DEFAULT_RANDOM_BLOB_SIZE) {
45
+ return new Uint8Array(nodeRandomBytes(sizeBytes));
46
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=blob-fixtures.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blob-fixtures.test.d.ts","sourceRoot":"","sources":["../../src/testing/blob-fixtures.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,46 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { DEFAULT_RANDOM_BLOB_SIZE, deterministicBytes, randomBlobBytes } from "./blob-fixtures.js";
3
+ describe("deterministicBytes", () => {
4
+ it("is deterministic across two calls with the same seed", () => {
5
+ const a = deterministicBytes(256, 42);
6
+ const b = deterministicBytes(256, 42);
7
+ expect(a).toEqual(b);
8
+ });
9
+ it("produces different content for different seeds", () => {
10
+ const a = deterministicBytes(256, 1);
11
+ const b = deterministicBytes(256, 2);
12
+ expect(a).not.toEqual(b);
13
+ });
14
+ it("returns exactly the requested size", () => {
15
+ expect(deterministicBytes(100).byteLength).toBe(100);
16
+ });
17
+ it("does not degenerate into long runs of the same byte", () => {
18
+ const bytes = deterministicBytes(4096);
19
+ let longestRun = 0;
20
+ let currentRun = 1;
21
+ for (let i = 1; i < bytes.length; i++) {
22
+ if (bytes[i] === bytes[i - 1]) {
23
+ currentRun++;
24
+ longestRun = Math.max(longestRun, currentRun);
25
+ }
26
+ else {
27
+ currentRun = 1;
28
+ }
29
+ }
30
+ expect(longestRun).toBeLessThan(20);
31
+ });
32
+ });
33
+ describe("randomBlobBytes", () => {
34
+ it("defaults to DEFAULT_RANDOM_BLOB_SIZE (96 KiB)", () => {
35
+ expect(DEFAULT_RANDOM_BLOB_SIZE).toBe(96 * 1024);
36
+ expect(randomBlobBytes().byteLength).toBe(DEFAULT_RANDOM_BLOB_SIZE);
37
+ });
38
+ it("returns exactly the requested size", () => {
39
+ expect(randomBlobBytes(128).byteLength).toBe(128);
40
+ });
41
+ it("produces different content across calls", () => {
42
+ const a = randomBlobBytes(64);
43
+ const b = randomBlobBytes(64);
44
+ expect(a).not.toEqual(b);
45
+ });
46
+ });
@@ -0,0 +1,10 @@
1
+ import "fake-indexeddb/auto";
2
+ /**
3
+ * resets `globalThis.indexedDB` to a brand new `IDBFactory`, so every
4
+ * caller starts from an empty database regardless of what earlier tests
5
+ * wrote. the `fake-indexeddb/auto` polyfill import above runs once, at
6
+ * module load time, installing `indexedDB` (and friends) as globals; this
7
+ * function only needs to swap in a fresh factory per test.
8
+ */
9
+ export declare function fakeIdbHarness(): void;
10
+ //# sourceMappingURL=idb-harness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idb-harness.d.ts","sourceRoot":"","sources":["../../src/testing/idb-harness.ts"],"names":[],"mappings":"AAMA,OAAO,qBAAqB,CAAC;AAG7B;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAErC"}
@@ -0,0 +1,17 @@
1
+ // installs the `fake-indexeddb` global and resets it to a fresh
2
+ // `IDBFactory` - call from a test's `beforeEach` so data doesn't leak
3
+ // across tests through a shared `indexedDB` instance (a real risk: a
4
+ // previous test's records are otherwise still there when the next test's
5
+ // store opens the same database name).
6
+ import "fake-indexeddb/auto";
7
+ import { IDBFactory } from "fake-indexeddb";
8
+ /**
9
+ * resets `globalThis.indexedDB` to a brand new `IDBFactory`, so every
10
+ * caller starts from an empty database regardless of what earlier tests
11
+ * wrote. the `fake-indexeddb/auto` polyfill import above runs once, at
12
+ * module load time, installing `indexedDB` (and friends) as globals; this
13
+ * function only needs to swap in a fresh factory per test.
14
+ */
15
+ export function fakeIdbHarness() {
16
+ globalThis.indexedDB = new IDBFactory();
17
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=idb-harness.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"idb-harness.test.d.ts","sourceRoot":"","sources":["../../src/testing/idb-harness.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,48 @@
1
+ import { beforeEach, describe, expect, it } from "vitest";
2
+ import { fakeIdbHarness } from "./idb-harness.js";
3
+ beforeEach(() => {
4
+ fakeIdbHarness();
5
+ });
6
+ function openTestDb(name) {
7
+ return new Promise((resolve, reject) => {
8
+ const request = indexedDB.open(name, 1);
9
+ request.onupgradeneeded = () => {
10
+ request.result.createObjectStore("things", { keyPath: "id" });
11
+ };
12
+ request.onsuccess = () => resolve(request.result);
13
+ request.onerror = () => reject(request.error);
14
+ });
15
+ }
16
+ function putThing(db, thing) {
17
+ return new Promise((resolve, reject) => {
18
+ const tx = db.transaction("things", "readwrite");
19
+ tx.objectStore("things").put(thing);
20
+ tx.oncomplete = () => resolve();
21
+ tx.onerror = () => reject(tx.error);
22
+ });
23
+ }
24
+ function getThing(db, id) {
25
+ return new Promise((resolve, reject) => {
26
+ const tx = db.transaction("things", "readonly");
27
+ const request = tx.objectStore("things").get(id);
28
+ request.onsuccess = () => resolve(request.result);
29
+ request.onerror = () => reject(request.error);
30
+ });
31
+ }
32
+ describe("fakeIdbHarness", () => {
33
+ it("provides a working indexedDB global", async () => {
34
+ const db = await openTestDb("harness-test-1");
35
+ await putThing(db, { id: "a", value: "hello" });
36
+ await expect(getThing(db, "a")).resolves.toEqual({ id: "a", value: "hello" });
37
+ db.close();
38
+ });
39
+ it("resets to an empty database between calls, even for the same db name", async () => {
40
+ const db1 = await openTestDb("harness-test-2");
41
+ await putThing(db1, { id: "a", value: "leftover" });
42
+ db1.close();
43
+ fakeIdbHarness();
44
+ const db2 = await openTestDb("harness-test-2");
45
+ await expect(getThing(db2, "a")).resolves.toBeUndefined();
46
+ db2.close();
47
+ });
48
+ });
@@ -0,0 +1,7 @@
1
+ export { createMockBiStream, createMockMidden, type MockBiStream, type MockMidden } from "./mock-node.js";
2
+ export { CollectingStream, makeServingStream, encodeJsonMessage, decodeJsonMessage, type CollectingStreamOptions, type MakeServingStreamOptions, type ServingStreamEntry, } from "./streams.js";
3
+ export { makeWav, type MakeWavOptions } from "./media.js";
4
+ export { deterministicBytes, randomBlobBytes, DEFAULT_RANDOM_BLOB_SIZE } from "./blob-fixtures.js";
5
+ export { fakeIdbHarness } from "./idb-harness.js";
6
+ export { createMockBlobFetcher, type MockBlobBehaviour, type MockBlobFetcher } from "./mock-blob-fetch.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC1G,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,GACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,11 @@
1
+ // exported test utilities: doubles and fixtures consuming apps use in
2
+ // their own suites instead of re-rolling mocks. no restriction on what
3
+ // this subpath imports at runtime (it is only ever imported by test
4
+ // files), but its own exports stay framework-free where practical - none
5
+ // of these doubles need solid-js.
6
+ export { createMockBiStream, createMockMidden } from "./mock-node.js";
7
+ export { CollectingStream, makeServingStream, encodeJsonMessage, decodeJsonMessage, } from "./streams.js";
8
+ export { makeWav } from "./media.js";
9
+ export { deterministicBytes, randomBlobBytes, DEFAULT_RANDOM_BLOB_SIZE } from "./blob-fixtures.js";
10
+ export { fakeIdbHarness } from "./idb-harness.js";
11
+ export { createMockBlobFetcher } from "./mock-blob-fetch.js";
@@ -0,0 +1,15 @@
1
+ export interface MakeWavOptions {
2
+ /** tone frequency in Hz. ignored when `silent` is true. default 440. */
3
+ freqHz?: number;
4
+ /** samples per second. default 8000 - plenty for tests, keeps file size
5
+ * (and thus transfer/hash test runtime) small. */
6
+ sampleRate?: number;
7
+ /** produce silence instead of a sine tone. */
8
+ silent?: boolean;
9
+ }
10
+ /**
11
+ * builds a valid mono 16-bit PCM WAV file. `durationSec` controls both
12
+ * file size and the decoded duration a real audio element would report.
13
+ */
14
+ export declare function makeWav(durationSec?: number, options?: MakeWavOptions): Uint8Array;
15
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/testing/media.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,cAAc;IAC7B,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;uDACmD;IACnD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,WAAW,SAAI,EAAE,OAAO,GAAE,cAAmB,GAAG,UAAU,CA+BjF"}
@@ -0,0 +1,37 @@
1
+ // synthetic audio generation for tests: a valid, decodable mono 16-bit
2
+ // PCM WAV file, either a sine tone (something a test can visibly play/
3
+ // decode) or silence (a minimal stand-in blob when only a valid file
4
+ // format matters, not its content).
5
+ /**
6
+ * builds a valid mono 16-bit PCM WAV file. `durationSec` controls both
7
+ * file size and the decoded duration a real audio element would report.
8
+ */
9
+ export function makeWav(durationSec = 1, options = {}) {
10
+ const { freqHz = 440, sampleRate = 8000, silent = false } = options;
11
+ const numSamples = Math.floor(sampleRate * durationSec);
12
+ const dataSize = numSamples * 2;
13
+ const buf = new ArrayBuffer(44 + dataSize);
14
+ const view = new DataView(buf);
15
+ const writeStr = (offset, s) => {
16
+ for (let i = 0; i < s.length; i++)
17
+ view.setUint8(offset + i, s.charCodeAt(i));
18
+ };
19
+ writeStr(0, "RIFF");
20
+ view.setUint32(4, 36 + dataSize, true);
21
+ writeStr(8, "WAVE");
22
+ writeStr(12, "fmt ");
23
+ view.setUint32(16, 16, true); // fmt chunk size
24
+ view.setUint16(20, 1, true); // PCM
25
+ view.setUint16(22, 1, true); // mono
26
+ view.setUint32(24, sampleRate, true);
27
+ view.setUint32(28, sampleRate * 2, true); // byte rate
28
+ view.setUint16(32, 2, true); // block align
29
+ view.setUint16(34, 16, true); // bits per sample
30
+ writeStr(36, "data");
31
+ view.setUint32(40, dataSize, true);
32
+ for (let i = 0; i < numSamples; i++) {
33
+ const sample = silent ? 0 : Math.sin((2 * Math.PI * freqHz * i) / sampleRate);
34
+ view.setInt16(44 + i * 2, Math.floor(sample * 0x4fff), true);
35
+ }
36
+ return new Uint8Array(buf);
37
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=media.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.test.d.ts","sourceRoot":"","sources":["../../src/testing/media.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,47 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { makeWav } from "./media.js";
3
+ function readHeader(bytes) {
4
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
5
+ const str = (offset, length) => String.fromCharCode(...bytes.subarray(offset, offset + length));
6
+ return {
7
+ riff: str(0, 4),
8
+ wave: str(8, 4),
9
+ fmt: str(12, 4),
10
+ audioFormat: view.getUint16(20, true),
11
+ numChannels: view.getUint16(22, true),
12
+ sampleRate: view.getUint32(24, true),
13
+ bitsPerSample: view.getUint16(34, true),
14
+ data: str(36, 4),
15
+ dataSize: view.getUint32(40, true),
16
+ };
17
+ }
18
+ describe("makeWav", () => {
19
+ it("produces a valid mono 16-bit PCM WAV header", () => {
20
+ const bytes = makeWav(1);
21
+ const header = readHeader(bytes);
22
+ expect(header.riff).toBe("RIFF");
23
+ expect(header.wave).toBe("WAVE");
24
+ expect(header.fmt).toBe("fmt ");
25
+ expect(header.audioFormat).toBe(1); // PCM
26
+ expect(header.numChannels).toBe(1); // mono
27
+ expect(header.bitsPerSample).toBe(16);
28
+ expect(header.data).toBe("data");
29
+ });
30
+ it("sizes the file for the requested duration and sample rate", () => {
31
+ const bytes = makeWav(2, { sampleRate: 8000 });
32
+ const header = readHeader(bytes);
33
+ expect(header.sampleRate).toBe(8000);
34
+ expect(header.dataSize).toBe(2 * 8000 * 2); // 2 bytes/sample
35
+ expect(bytes.byteLength).toBe(44 + header.dataSize);
36
+ });
37
+ it("silent mode produces all-zero sample data", () => {
38
+ const bytes = makeWav(1, { silent: true, sampleRate: 100 });
39
+ const samples = bytes.subarray(44);
40
+ expect(samples.every((b) => b === 0)).toBe(true);
41
+ });
42
+ it("non-silent mode produces a non-zero sine tone", () => {
43
+ const bytes = makeWav(1, { freqHz: 440, sampleRate: 8000 });
44
+ const samples = bytes.subarray(44);
45
+ expect(samples.some((b) => b !== 0)).toBe(true);
46
+ });
47
+ });
@@ -0,0 +1,33 @@
1
+ export type MockBlobBehaviour = {
2
+ type: "instant";
3
+ } | {
4
+ type: "delayed";
5
+ ms?: number;
6
+ } | {
7
+ type: "stall";
8
+ } | {
9
+ type: "error";
10
+ message?: string;
11
+ };
12
+ export interface MockBlobFetcher {
13
+ /** sets (or clears, with `null`) the simulated behaviour for `id`.
14
+ * an id with no behaviour set defaults to `{ type: "instant" }`. */
15
+ setBehaviour(id: string, behaviour: MockBlobBehaviour | null): void;
16
+ /** simulates fetching `id`: resolves/rejects/stalls according to its
17
+ * configured behaviour, then resolves with `resolveBytes(id)`'s
18
+ * result. `onProgress` (if given) is called once with `1` right
19
+ * before the bytes resolve - this double has no partial-progress
20
+ * simulation, only success/failure/stall timing. */
21
+ fetchBlob(id: string, onProgress?: (fraction: number) => void): Promise<Uint8Array>;
22
+ }
23
+ /**
24
+ * creates a mock blob fetcher: a per-id behaviour table plus a
25
+ * `fetchBlob` function that simulates it, generalized off the pattern of
26
+ * installing a fetch override that a mocked transport consults instead of
27
+ * making a real network call. the actual bytes returned on success come
28
+ * from the caller-supplied `resolveBytes` (typically `deterministicBytes`
29
+ * or `makeWav`) - this helper only controls timing and success/failure,
30
+ * not payload shape.
31
+ */
32
+ export declare function createMockBlobFetcher(resolveBytes: (id: string) => Uint8Array | Promise<Uint8Array>): MockBlobFetcher;
33
+ //# sourceMappingURL=mock-blob-fetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-blob-fetch.d.ts","sourceRoot":"","sources":["../../src/testing/mock-blob-fetch.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,iBAAiB,GACzB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAIxC,MAAM,WAAW,eAAe;IAC9B;yEACqE;IACrE,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,GAAG,IAAI,GAAG,IAAI,CAAC;IACpE;;;;yDAIqD;IACrD,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACrF;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,eAAe,CA6BrH"}
@@ -0,0 +1,39 @@
1
+ // a scriptable stand-in for a blob transport: per-id behaviour (instant
2
+ // success, a delayed success, an unresolved stall, or a hard error) so a
3
+ // test can exercise progress/cancel/retry paths without real network
4
+ // flakiness or timing.
5
+ const DEFAULT_DELAY_MS = 50;
6
+ /**
7
+ * creates a mock blob fetcher: a per-id behaviour table plus a
8
+ * `fetchBlob` function that simulates it, generalized off the pattern of
9
+ * installing a fetch override that a mocked transport consults instead of
10
+ * making a real network call. the actual bytes returned on success come
11
+ * from the caller-supplied `resolveBytes` (typically `deterministicBytes`
12
+ * or `makeWav`) - this helper only controls timing and success/failure,
13
+ * not payload shape.
14
+ */
15
+ export function createMockBlobFetcher(resolveBytes) {
16
+ const behaviours = new Map();
17
+ function setBehaviour(id, behaviour) {
18
+ if (behaviour)
19
+ behaviours.set(id, behaviour);
20
+ else
21
+ behaviours.delete(id);
22
+ }
23
+ async function fetchBlob(id, onProgress) {
24
+ const behaviour = behaviours.get(id) ?? { type: "instant" };
25
+ if (behaviour.type === "error") {
26
+ throw new Error(behaviour.message ?? `mock blob error: ${id}`);
27
+ }
28
+ if (behaviour.type === "stall") {
29
+ // never resolves - simulates a hung transport for cancel-path tests
30
+ return new Promise(() => { });
31
+ }
32
+ if (behaviour.type === "delayed") {
33
+ await new Promise((resolve) => setTimeout(resolve, behaviour.ms ?? DEFAULT_DELAY_MS));
34
+ }
35
+ onProgress?.(1);
36
+ return await resolveBytes(id);
37
+ }
38
+ return { setBehaviour, fetchBlob };
39
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mock-blob-fetch.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-blob-fetch.test.d.ts","sourceRoot":"","sources":["../../src/testing/mock-blob-fetch.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,65 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+ import { createMockBlobFetcher } from "./mock-blob-fetch.js";
3
+ describe("createMockBlobFetcher", () => {
4
+ it("defaults to instant success, returning the resolver's bytes", async () => {
5
+ const fetcher = createMockBlobFetcher((id) => new Uint8Array([id.length]));
6
+ await expect(fetcher.fetchBlob("abc")).resolves.toEqual(new Uint8Array([3]));
7
+ });
8
+ it("calls onProgress(1) right before resolving", async () => {
9
+ const fetcher = createMockBlobFetcher(() => new Uint8Array([1]));
10
+ const onProgress = vi.fn();
11
+ await fetcher.fetchBlob("id", onProgress);
12
+ expect(onProgress).toHaveBeenCalledTimes(1);
13
+ expect(onProgress).toHaveBeenCalledWith(1);
14
+ });
15
+ it("delayed behaviour waits before resolving", async () => {
16
+ vi.useFakeTimers();
17
+ try {
18
+ const fetcher = createMockBlobFetcher(() => new Uint8Array([1]));
19
+ fetcher.setBehaviour("id", { type: "delayed", ms: 500 });
20
+ let resolved = false;
21
+ const promise = fetcher.fetchBlob("id").then((bytes) => {
22
+ resolved = true;
23
+ return bytes;
24
+ });
25
+ await vi.advanceTimersByTimeAsync(499);
26
+ expect(resolved).toBe(false);
27
+ await vi.advanceTimersByTimeAsync(1);
28
+ await expect(promise).resolves.toEqual(new Uint8Array([1]));
29
+ expect(resolved).toBe(true);
30
+ }
31
+ finally {
32
+ vi.useRealTimers();
33
+ }
34
+ });
35
+ it("error behaviour rejects with the configured message", async () => {
36
+ const fetcher = createMockBlobFetcher(() => new Uint8Array([1]));
37
+ fetcher.setBehaviour("id", { type: "error", message: "boom" });
38
+ await expect(fetcher.fetchBlob("id")).rejects.toThrow("boom");
39
+ });
40
+ it("error behaviour without a message still rejects", async () => {
41
+ const fetcher = createMockBlobFetcher(() => new Uint8Array([1]));
42
+ fetcher.setBehaviour("id", { type: "error" });
43
+ await expect(fetcher.fetchBlob("id")).rejects.toThrow(/mock blob error/);
44
+ });
45
+ it("stall behaviour never resolves", async () => {
46
+ const fetcher = createMockBlobFetcher(() => new Uint8Array([1]));
47
+ fetcher.setBehaviour("id", { type: "stall" });
48
+ let settled = false;
49
+ void fetcher.fetchBlob("id").then(() => (settled = true));
50
+ await new Promise((r) => setTimeout(r, 20));
51
+ expect(settled).toBe(false);
52
+ });
53
+ it("setBehaviour(id, null) clears an override, reverting to instant", async () => {
54
+ const fetcher = createMockBlobFetcher(() => new Uint8Array([1]));
55
+ fetcher.setBehaviour("id", { type: "error" });
56
+ fetcher.setBehaviour("id", null);
57
+ await expect(fetcher.fetchBlob("id")).resolves.toEqual(new Uint8Array([1]));
58
+ });
59
+ it("behaviour is per-id", async () => {
60
+ const fetcher = createMockBlobFetcher((id) => new Uint8Array([id.charCodeAt(0)]));
61
+ fetcher.setBehaviour("a", { type: "error" });
62
+ await expect(fetcher.fetchBlob("a")).rejects.toThrow();
63
+ await expect(fetcher.fetchBlob("b")).resolves.toEqual(new Uint8Array(["b".charCodeAt(0)]));
64
+ });
65
+ });
@@ -0,0 +1,36 @@
1
+ import { vi } from "vitest";
2
+ import type { BiStreamLike, MiddenStreamNode } from "../automerge/types.js";
3
+ /** a `BiStreamLike` double whose queued/pushed messages a test controls
4
+ * directly, plus introspection fields (`_written`, `_closed`) for
5
+ * asserting on what was sent and whether the stream was closed. */
6
+ export interface MockBiStream extends BiStreamLike {
7
+ _messageQueue: (Uint8Array | null)[];
8
+ _written: Uint8Array[];
9
+ _closed: boolean;
10
+ _readResolvers: ((value: Uint8Array | null) => void)[];
11
+ write_message: ReturnType<typeof vi.fn>;
12
+ read_message: ReturnType<typeof vi.fn>;
13
+ read_to_end?: ReturnType<typeof vi.fn>;
14
+ write_raw_and_finish?: ReturnType<typeof vi.fn>;
15
+ close: ReturnType<typeof vi.fn>;
16
+ /** push a message (or `null` to simulate the peer closing the stream)
17
+ * for the next pending/future `read_message()` call to resolve with. */
18
+ pushMessage(data: Uint8Array | null): void;
19
+ }
20
+ /** creates a mock bidirectional stream addressed to `peerId`. reads block
21
+ * until a message is pushed via `pushMessage`; writes are recorded in
22
+ * `_written` for assertions. */
23
+ export declare function createMockBiStream(peerId: string, alpn?: string): MockBiStream;
24
+ /** a `MiddenStreamNode` double whose inbound streams (`accept()`) a test
25
+ * pushes by hand, alongside dialing (`open_bi()`) that always succeeds
26
+ * with a fresh mock stream. */
27
+ export interface MockMidden extends MiddenStreamNode {
28
+ open_bi: ReturnType<typeof vi.fn>;
29
+ accept: ReturnType<typeof vi.fn>;
30
+ /** push a stream (or `null` to simulate no more inbound connections)
31
+ * for the next pending/future `accept()` call to resolve with. */
32
+ pushIncoming(stream: BiStreamLike | null): void;
33
+ }
34
+ /** creates a mock midden node identified by `nodeId`. */
35
+ export declare function createMockMidden(nodeId?: string): MockMidden;
36
+ //# sourceMappingURL=mock-node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-node.d.ts","sourceRoot":"","sources":["../../src/testing/mock-node.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE5B,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE5E;;oEAEoE;AACpE,MAAM,WAAW,YAAa,SAAQ,YAAY;IAChD,aAAa,EAAE,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC;IACrC,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,CAAC,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;IACvD,aAAa,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IACxC,YAAY,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IACvC,WAAW,CAAC,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IACvC,oBAAoB,CAAC,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAChD,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAChC;6EACyE;IACzE,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;CAC5C;AAED;;iCAEiC;AACjC,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,MAAgC,GAAG,YAAY,CA0DvG;AAED;;gCAEgC;AAChC,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IAClD,OAAO,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IAClC,MAAM,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;IACjC;uEACmE;IACnE,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,GAAG,IAAI,CAAC;CACjD;AAED,yDAAyD;AACzD,wBAAgB,gBAAgB,CAAC,MAAM,GAAE,MAAuB,GAAG,UAAU,CA8B5E"}