@zudojs/testing 0.0.1

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 (183) hide show
  1. package/README.md +35 -0
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/assertions/errorAssertions.core.d.ts +37 -0
  4. package/dist/assertions/errorAssertions.core.d.ts.map +1 -0
  5. package/dist/assertions/errorAssertions.core.js +82 -0
  6. package/dist/assertions/errorAssertions.core.js.map +1 -0
  7. package/dist/assertions/eventAssertions.core.d.ts +44 -0
  8. package/dist/assertions/eventAssertions.core.d.ts.map +1 -0
  9. package/dist/assertions/eventAssertions.core.js +63 -0
  10. package/dist/assertions/eventAssertions.core.js.map +1 -0
  11. package/dist/assertions/httpAssertions.core.d.ts +54 -0
  12. package/dist/assertions/httpAssertions.core.d.ts.map +1 -0
  13. package/dist/assertions/httpAssertions.core.js +80 -0
  14. package/dist/assertions/httpAssertions.core.js.map +1 -0
  15. package/dist/assertions/index.d.ts +9 -0
  16. package/dist/assertions/index.d.ts.map +1 -0
  17. package/dist/assertions/index.js +9 -0
  18. package/dist/assertions/index.js.map +1 -0
  19. package/dist/cleanupManager/cleanupManager.core.d.ts +54 -0
  20. package/dist/cleanupManager/cleanupManager.core.d.ts.map +1 -0
  21. package/dist/cleanupManager/cleanupManager.core.js +60 -0
  22. package/dist/cleanupManager/cleanupManager.core.js.map +1 -0
  23. package/dist/cleanupManager/index.d.ts +8 -0
  24. package/dist/cleanupManager/index.d.ts.map +1 -0
  25. package/dist/cleanupManager/index.js +7 -0
  26. package/dist/cleanupManager/index.js.map +1 -0
  27. package/dist/fixtures/eventFixtures.core.d.ts +53 -0
  28. package/dist/fixtures/eventFixtures.core.d.ts.map +1 -0
  29. package/dist/fixtures/eventFixtures.core.js +59 -0
  30. package/dist/fixtures/eventFixtures.core.js.map +1 -0
  31. package/dist/fixtures/index.d.ts +10 -0
  32. package/dist/fixtures/index.d.ts.map +1 -0
  33. package/dist/fixtures/index.js +8 -0
  34. package/dist/fixtures/index.js.map +1 -0
  35. package/dist/fixtures/messageFixtures.core.d.ts +53 -0
  36. package/dist/fixtures/messageFixtures.core.d.ts.map +1 -0
  37. package/dist/fixtures/messageFixtures.core.js +59 -0
  38. package/dist/fixtures/messageFixtures.core.js.map +1 -0
  39. package/dist/httpTesting/httpRequest.core.d.ts +69 -0
  40. package/dist/httpTesting/httpRequest.core.d.ts.map +1 -0
  41. package/dist/httpTesting/httpRequest.core.js +114 -0
  42. package/dist/httpTesting/httpRequest.core.js.map +1 -0
  43. package/dist/httpTesting/httpResponse.core.d.ts +20 -0
  44. package/dist/httpTesting/httpResponse.core.d.ts.map +1 -0
  45. package/dist/httpTesting/httpResponse.core.js +77 -0
  46. package/dist/httpTesting/httpResponse.core.js.map +1 -0
  47. package/dist/httpTesting/httpResponse.helpers.d.ts +24 -0
  48. package/dist/httpTesting/httpResponse.helpers.d.ts.map +1 -0
  49. package/dist/httpTesting/httpResponse.helpers.js +41 -0
  50. package/dist/httpTesting/httpResponse.helpers.js.map +1 -0
  51. package/dist/httpTesting/httpResponse.type.d.ts +25 -0
  52. package/dist/httpTesting/httpResponse.type.d.ts.map +1 -0
  53. package/dist/httpTesting/httpResponse.type.js +7 -0
  54. package/dist/httpTesting/httpResponse.type.js.map +1 -0
  55. package/dist/httpTesting/httpStatusCode.type.d.ts +10 -0
  56. package/dist/httpTesting/httpStatusCode.type.d.ts.map +1 -0
  57. package/dist/httpTesting/httpStatusCode.type.js +9 -0
  58. package/dist/httpTesting/httpStatusCode.type.js.map +1 -0
  59. package/dist/httpTesting/index.d.ts +11 -0
  60. package/dist/httpTesting/index.d.ts.map +1 -0
  61. package/dist/httpTesting/index.js +9 -0
  62. package/dist/httpTesting/index.js.map +1 -0
  63. package/dist/index.d.ts +24 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +24 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/mocking/index.d.ts +11 -0
  68. package/dist/mocking/index.d.ts.map +1 -0
  69. package/dist/mocking/index.js +9 -0
  70. package/dist/mocking/index.js.map +1 -0
  71. package/dist/mocking/mockFn.core.d.ts +40 -0
  72. package/dist/mocking/mockFn.core.d.ts.map +1 -0
  73. package/dist/mocking/mockFn.core.js +104 -0
  74. package/dist/mocking/mockFn.core.js.map +1 -0
  75. package/dist/mocking/spy.core.d.ts +66 -0
  76. package/dist/mocking/spy.core.d.ts.map +1 -0
  77. package/dist/mocking/spy.core.js +100 -0
  78. package/dist/mocking/spy.core.js.map +1 -0
  79. package/dist/mocking/stub.core.d.ts +56 -0
  80. package/dist/mocking/stub.core.d.ts.map +1 -0
  81. package/dist/mocking/stub.core.js +77 -0
  82. package/dist/mocking/stub.core.js.map +1 -0
  83. package/dist/spyLogger/index.d.ts +8 -0
  84. package/dist/spyLogger/index.d.ts.map +1 -0
  85. package/dist/spyLogger/index.js +7 -0
  86. package/dist/spyLogger/index.js.map +1 -0
  87. package/dist/spyLogger/spyLogger.core.d.ts +16 -0
  88. package/dist/spyLogger/spyLogger.core.d.ts.map +1 -0
  89. package/dist/spyLogger/spyLogger.core.js +69 -0
  90. package/dist/spyLogger/spyLogger.core.js.map +1 -0
  91. package/dist/spyLogger/spyLogger.type.d.ts +23 -0
  92. package/dist/spyLogger/spyLogger.type.d.ts.map +1 -0
  93. package/dist/spyLogger/spyLogger.type.js +7 -0
  94. package/dist/spyLogger/spyLogger.type.js.map +1 -0
  95. package/dist/testApplication/index.d.ts +8 -0
  96. package/dist/testApplication/index.d.ts.map +1 -0
  97. package/dist/testApplication/index.js +7 -0
  98. package/dist/testApplication/index.js.map +1 -0
  99. package/dist/testApplication/testApplication.core.d.ts +49 -0
  100. package/dist/testApplication/testApplication.core.d.ts.map +1 -0
  101. package/dist/testApplication/testApplication.core.js +51 -0
  102. package/dist/testApplication/testApplication.core.js.map +1 -0
  103. package/dist/testClock/index.d.ts +8 -0
  104. package/dist/testClock/index.d.ts.map +1 -0
  105. package/dist/testClock/index.js +7 -0
  106. package/dist/testClock/index.js.map +1 -0
  107. package/dist/testClock/testClock.core.d.ts +54 -0
  108. package/dist/testClock/testClock.core.d.ts.map +1 -0
  109. package/dist/testClock/testClock.core.js +57 -0
  110. package/dist/testClock/testClock.core.js.map +1 -0
  111. package/dist/testConfig/index.d.ts +8 -0
  112. package/dist/testConfig/index.d.ts.map +1 -0
  113. package/dist/testConfig/index.js +7 -0
  114. package/dist/testConfig/index.js.map +1 -0
  115. package/dist/testConfig/testConfig.core.d.ts +58 -0
  116. package/dist/testConfig/testConfig.core.d.ts.map +1 -0
  117. package/dist/testConfig/testConfig.core.js +53 -0
  118. package/dist/testConfig/testConfig.core.js.map +1 -0
  119. package/dist/testContainer/index.d.ts +8 -0
  120. package/dist/testContainer/index.d.ts.map +1 -0
  121. package/dist/testContainer/index.js +7 -0
  122. package/dist/testContainer/index.js.map +1 -0
  123. package/dist/testContainer/testContainer.core.d.ts +60 -0
  124. package/dist/testContainer/testContainer.core.d.ts.map +1 -0
  125. package/dist/testContainer/testContainer.core.js +47 -0
  126. package/dist/testContainer/testContainer.core.js.map +1 -0
  127. package/dist/testContext/index.d.ts +10 -0
  128. package/dist/testContext/index.d.ts.map +1 -0
  129. package/dist/testContext/index.js +8 -0
  130. package/dist/testContext/index.js.map +1 -0
  131. package/dist/testContext/testContext.core.d.ts +32 -0
  132. package/dist/testContext/testContext.core.d.ts.map +1 -0
  133. package/dist/testContext/testContext.core.js +28 -0
  134. package/dist/testContext/testContext.core.js.map +1 -0
  135. package/dist/testContext/testContext.recorder.core.d.ts +19 -0
  136. package/dist/testContext/testContext.recorder.core.d.ts.map +1 -0
  137. package/dist/testContext/testContext.recorder.core.js +74 -0
  138. package/dist/testContext/testContext.recorder.core.js.map +1 -0
  139. package/dist/testContext/testContext.recorder.type.d.ts +59 -0
  140. package/dist/testContext/testContext.recorder.type.d.ts.map +1 -0
  141. package/dist/testContext/testContext.recorder.type.js +7 -0
  142. package/dist/testContext/testContext.recorder.type.js.map +1 -0
  143. package/dist/testEventBus/index.d.ts +8 -0
  144. package/dist/testEventBus/index.d.ts.map +1 -0
  145. package/dist/testEventBus/index.js +7 -0
  146. package/dist/testEventBus/index.js.map +1 -0
  147. package/dist/testEventBus/testEventBus.core.d.ts +61 -0
  148. package/dist/testEventBus/testEventBus.core.d.ts.map +1 -0
  149. package/dist/testEventBus/testEventBus.core.js +61 -0
  150. package/dist/testEventBus/testEventBus.core.js.map +1 -0
  151. package/dist/testMessageBus/index.d.ts +8 -0
  152. package/dist/testMessageBus/index.d.ts.map +1 -0
  153. package/dist/testMessageBus/index.js +7 -0
  154. package/dist/testMessageBus/index.js.map +1 -0
  155. package/dist/testMessageBus/testMessageBus.core.d.ts +61 -0
  156. package/dist/testMessageBus/testMessageBus.core.d.ts.map +1 -0
  157. package/dist/testMessageBus/testMessageBus.core.js +61 -0
  158. package/dist/testMessageBus/testMessageBus.core.js.map +1 -0
  159. package/dist/testQueue/index.d.ts +8 -0
  160. package/dist/testQueue/index.d.ts.map +1 -0
  161. package/dist/testQueue/index.js +7 -0
  162. package/dist/testQueue/index.js.map +1 -0
  163. package/dist/testQueue/testQueue.core.d.ts +46 -0
  164. package/dist/testQueue/testQueue.core.d.ts.map +1 -0
  165. package/dist/testQueue/testQueue.core.js +36 -0
  166. package/dist/testQueue/testQueue.core.js.map +1 -0
  167. package/dist/testSerialization/index.d.ts +7 -0
  168. package/dist/testSerialization/index.d.ts.map +1 -0
  169. package/dist/testSerialization/index.js +7 -0
  170. package/dist/testSerialization/index.js.map +1 -0
  171. package/dist/testSerialization/serializationAssertions.core.d.ts +37 -0
  172. package/dist/testSerialization/serializationAssertions.core.d.ts.map +1 -0
  173. package/dist/testSerialization/serializationAssertions.core.js +63 -0
  174. package/dist/testSerialization/serializationAssertions.core.js.map +1 -0
  175. package/dist/testStorage/index.d.ts +7 -0
  176. package/dist/testStorage/index.d.ts.map +1 -0
  177. package/dist/testStorage/index.js +7 -0
  178. package/dist/testStorage/index.js.map +1 -0
  179. package/dist/testStorage/testStorageMemory.core.d.ts +30 -0
  180. package/dist/testStorage/testStorageMemory.core.d.ts.map +1 -0
  181. package/dist/testStorage/testStorageMemory.core.js +52 -0
  182. package/dist/testStorage/testStorageMemory.core.js.map +1 -0
  183. package/package.json +64 -0
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Test queue helpers.
3
+ *
4
+ * InMemoryQueue with recording and assertion support.
5
+ */
6
+ export { createTestQueue } from "./testQueue.core.js";
7
+ export type { RecordedJob, TestQueue } from "./testQueue.core.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testQueue/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Test queue helpers.
3
+ *
4
+ * InMemoryQueue with recording and assertion support.
5
+ */
6
+ export { createTestQueue } from "./testQueue.core.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testQueue/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Test queue helpers.
3
+ *
4
+ * Wraps the real InMemoryQueue with recording and assertion support.
5
+ */
6
+ import { InMemoryQueue } from "@zudojs/queue";
7
+ import type { Job, QueueName, QueueOptions, QueueStats, JobOptions } from "@zudojs/queue";
8
+ /**
9
+ * A recorded job addition.
10
+ */
11
+ export interface RecordedJob<TData = unknown> {
12
+ readonly job: Job<TData>;
13
+ readonly timestamp: Date;
14
+ }
15
+ /**
16
+ * A test queue with recording capabilities.
17
+ */
18
+ export interface TestQueue<TData = unknown> {
19
+ readonly queue: InMemoryQueue<TData>;
20
+ /**
21
+ * All recorded jobs.
22
+ */
23
+ readonly jobs: readonly RecordedJob<TData>[];
24
+ /**
25
+ * Add a job and record it.
26
+ */
27
+ add: (name: string, data: TData, options?: JobOptions) => Promise<Job<TData>>;
28
+ /**
29
+ * Find jobs by name.
30
+ */
31
+ findByName: (name: string) => readonly RecordedJob<TData>[];
32
+ /**
33
+ * Get all job states.
34
+ */
35
+ getStats: () => Promise<QueueStats>;
36
+ /**
37
+ * Clear recorded jobs.
38
+ */
39
+ clear: () => void;
40
+ /**
41
+ * Close the queue.
42
+ */
43
+ close: () => Promise<void>;
44
+ }
45
+ export declare function createTestQueue<TData = unknown>(name: QueueName, options?: QueueOptions): TestQueue<TData>;
46
+ //# sourceMappingURL=testQueue.core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testQueue.core.d.ts","sourceRoot":"","sources":["../../src/testQueue/testQueue.core.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAuB,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,KAAK,EACV,GAAG,EAEH,SAAS,EACT,YAAY,EACZ,UAAU,EAEV,UAAU,EACX,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,KAAK,GAAG,OAAO;IAC1C,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,KAAK,GAAG,OAAO;IACxC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;IAErC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,SAAS,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;IAE7C;;OAEG;IACH,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,UAAU,KAAK,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAE9E;;OAEG;IACH,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;IAE5D;;OAEG;IACH,QAAQ,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IAEpC;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAElB;;OAEG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AAED,wBAAgB,eAAe,CAAC,KAAK,GAAG,OAAO,EAC7C,IAAI,EAAE,SAAS,EACf,OAAO,CAAC,EAAE,YAAY,GACrB,SAAS,CAAC,KAAK,CAAC,CA4ClB"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Test queue helpers.
3
+ *
4
+ * Wraps the real InMemoryQueue with recording and assertion support.
5
+ */
6
+ import { createInMemoryQueue, InMemoryQueue } from "@zudojs/queue";
7
+ export function createTestQueue(name, options) {
8
+ const queue = createInMemoryQueue(name, options);
9
+ const recordedJobs = [];
10
+ const add = async (jobName, data, jobOptions) => {
11
+ const job = await queue.add(jobName, data, jobOptions);
12
+ recordedJobs.push({
13
+ job,
14
+ timestamp: new Date(),
15
+ });
16
+ return job;
17
+ };
18
+ const findByName = (name) => recordedJobs.filter((r) => r.job.name === name);
19
+ const getStats = async () => queue.getStats();
20
+ const clear = () => {
21
+ recordedJobs.length = 0;
22
+ };
23
+ const close = async () => {
24
+ await queue.close();
25
+ };
26
+ return {
27
+ queue,
28
+ jobs: recordedJobs,
29
+ add,
30
+ findByName,
31
+ getStats,
32
+ clear,
33
+ close,
34
+ };
35
+ }
36
+ //# sourceMappingURL=testQueue.core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testQueue.core.js","sourceRoot":"","sources":["../../src/testQueue/testQueue.core.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAyDnE,MAAM,UAAU,eAAe,CAC7B,IAAe,EACf,OAAsB;IAEtB,MAAM,KAAK,GAAG,mBAAmB,CAC/B,IAAI,EACJ,OAAO,CACgB,CAAC;IAC1B,MAAM,YAAY,GAAyB,EAAE,CAAC;IAE9C,MAAM,GAAG,GAAG,KAAK,EACf,OAAe,EACf,IAAW,EACX,UAAuB,EACF,EAAE;QACvB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QAEvD,YAAY,CAAC,IAAI,CAAC;YAChB,GAAG;YACH,SAAS,EAAE,IAAI,IAAI,EAAE;SACtB,CAAC,CAAC;QAEH,OAAO,GAAG,CAAC;IACb,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,CAAC,IAAY,EAAiC,EAAE,CACjE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAElD,MAAM,QAAQ,GAAG,KAAK,IAAyB,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAEnE,MAAM,KAAK,GAAG,GAAS,EAAE;QACvB,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1B,CAAC,CAAC;IAEF,MAAM,KAAK,GAAG,KAAK,IAAmB,EAAE;QACtC,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC,CAAC;IAEF,OAAO;QACL,KAAK;QACL,IAAI,EAAE,YAAY;QAClB,GAAG;QACH,UAAU;QACV,QAAQ;QACR,KAAK;QACL,KAAK;KACN,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @zudojs/testing — Serialization testing helpers.
3
+ *
4
+ * Assertions for testing serialization round-trips and type preservation.
5
+ */
6
+ export { assertSerializesCorrectly, assertSerializesTo, assertDeserializesTo, assertTypePreservesRoundTrip, } from "./serializationAssertions.core.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testSerialization/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @zudojs/testing — Serialization testing helpers.
3
+ *
4
+ * Assertions for testing serialization round-trips and type preservation.
5
+ */
6
+ export { assertSerializesCorrectly, assertSerializesTo, assertDeserializesTo, assertTypePreservesRoundTrip, } from "./serializationAssertions.core.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testSerialization/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EAClB,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @zudojs/testing — Serialization assertions.
3
+ *
4
+ * Helpers for testing serialization round-trips and type preservation.
5
+ */
6
+ import { JSONSerializer } from "@zudojs/serialization";
7
+ /**
8
+ * Assert that a value round-trips through serialization correctly.
9
+ *
10
+ * @param value - The value to test.
11
+ * @param options - Optional serializer and options.
12
+ */
13
+ export declare function assertSerializesCorrectly<T>(value: T, options?: {
14
+ readonly serializer?: JSONSerializer;
15
+ readonly preserveTypes?: boolean;
16
+ }): void;
17
+ /**
18
+ * Assert that a value serializes to the expected JSON string.
19
+ */
20
+ export declare function assertSerializesTo<T>(value: T, expected: string, options?: {
21
+ readonly serializer?: JSONSerializer;
22
+ readonly preserveTypes?: boolean;
23
+ }): void;
24
+ /**
25
+ * Assert that a JSON string deserializes to the expected value.
26
+ */
27
+ export declare function assertDeserializesTo<T>(json: string, expected: T, options?: {
28
+ readonly serializer?: JSONSerializer;
29
+ readonly preserveTypes?: boolean;
30
+ }): void;
31
+ /**
32
+ * Assert that type preservation round-trips correctly for a specific type.
33
+ *
34
+ * Useful for testing custom transformers.
35
+ */
36
+ export declare function assertTypePreservesRoundTrip<T>(value: T, checker: (restored: T) => boolean, description: string): void;
37
+ //# sourceMappingURL=serializationAssertions.core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializationAssertions.core.d.ts","sourceRoot":"","sources":["../../src/testSerialization/serializationAssertions.core.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EACzC,KAAK,EAAE,CAAC,EACR,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC;IACrC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC,GACA,IAAI,CAcN;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC;IACrC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC,GACA,IAAI,CASN;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,CAAC,EACX,OAAO,CAAC,EAAE;IACR,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC;IACrC,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC,GACA,IAAI,CAWN;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,CAAC,EAC5C,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,KAAK,OAAO,EACjC,WAAW,EAAE,MAAM,GAClB,IAAI,CAUN"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @zudojs/testing — Serialization assertions.
3
+ *
4
+ * Helpers for testing serialization round-trips and type preservation.
5
+ */
6
+ import { JSONSerializer } from "@zudojs/serialization";
7
+ const defaultSerializer = new JSONSerializer();
8
+ /**
9
+ * Assert that a value round-trips through serialization correctly.
10
+ *
11
+ * @param value - The value to test.
12
+ * @param options - Optional serializer and options.
13
+ */
14
+ export function assertSerializesCorrectly(value, options) {
15
+ const serializer = options?.serializer ?? defaultSerializer;
16
+ const json = serializer.serialize(value, {
17
+ preserveTypes: options?.preserveTypes,
18
+ });
19
+ const restored = serializer.deserialize(json, {
20
+ preserveTypes: options?.preserveTypes,
21
+ });
22
+ if (JSON.stringify(restored) !== JSON.stringify(value)) {
23
+ throw new Error(`Serialization round-trip failed: expected ${JSON.stringify(value)}, got ${JSON.stringify(restored)}`);
24
+ }
25
+ }
26
+ /**
27
+ * Assert that a value serializes to the expected JSON string.
28
+ */
29
+ export function assertSerializesTo(value, expected, options) {
30
+ const serializer = options?.serializer ?? defaultSerializer;
31
+ const actual = serializer.serialize(value, {
32
+ preserveTypes: options?.preserveTypes,
33
+ });
34
+ if (actual !== expected) {
35
+ throw new Error(`Expected serialized output ${expected}, got ${actual}`);
36
+ }
37
+ }
38
+ /**
39
+ * Assert that a JSON string deserializes to the expected value.
40
+ */
41
+ export function assertDeserializesTo(json, expected, options) {
42
+ const serializer = options?.serializer ?? defaultSerializer;
43
+ const actual = serializer.deserialize(json, {
44
+ preserveTypes: options?.preserveTypes,
45
+ });
46
+ if (JSON.stringify(actual) !== JSON.stringify(expected)) {
47
+ throw new Error(`Expected deserialized value ${JSON.stringify(expected)}, got ${JSON.stringify(actual)}`);
48
+ }
49
+ }
50
+ /**
51
+ * Assert that type preservation round-trips correctly for a specific type.
52
+ *
53
+ * Useful for testing custom transformers.
54
+ */
55
+ export function assertTypePreservesRoundTrip(value, checker, description) {
56
+ const serializer = new JSONSerializer();
57
+ const json = serializer.serialize(value, { preserveTypes: true });
58
+ const restored = serializer.deserialize(json, { preserveTypes: true });
59
+ if (!checker(restored)) {
60
+ throw new Error(`Type preservation failed for ${description}: ${JSON.stringify(value)} → ${JSON.stringify(restored)}`);
61
+ }
62
+ }
63
+ //# sourceMappingURL=serializationAssertions.core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serializationAssertions.core.js","sourceRoot":"","sources":["../../src/testSerialization/serializationAssertions.core.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,iBAAiB,GAAG,IAAI,cAAc,EAAE,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAQ,EACR,OAGC;IAED,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,iBAAiB,CAAC;IAC5D,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,EAAE;QACvC,aAAa,EAAE,OAAO,EAAE,aAAa;KACtC,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW,CAAI,IAAI,EAAE;QAC/C,aAAa,EAAE,OAAO,EAAE,aAAa;KACtC,CAAC,CAAC;IAEH,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,KAAK,CACb,6CAA6C,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CACtG,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,KAAQ,EACR,QAAgB,EAChB,OAGC;IAED,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,iBAAiB,CAAC;IAC5D,MAAM,MAAM,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,EAAE;QACzC,aAAa,EAAE,OAAO,EAAE,aAAa;KACtC,CAAC,CAAC;IAEH,IAAI,MAAM,KAAK,QAAQ,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,SAAS,MAAM,EAAE,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAY,EACZ,QAAW,EACX,OAGC;IAED,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,iBAAiB,CAAC;IAC5D,MAAM,MAAM,GAAG,UAAU,CAAC,WAAW,CAAI,IAAI,EAAE;QAC7C,aAAa,EAAE,OAAO,EAAE,aAAa;KACtC,CAAC,CAAC;IAEH,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CACb,+BAA+B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CACzF,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,4BAA4B,CAC1C,KAAQ,EACR,OAAiC,EACjC,WAAmB;IAEnB,MAAM,UAAU,GAAG,IAAI,cAAc,EAAE,CAAC;IACxC,MAAM,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW,CAAI,IAAI,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAE1E,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,gCAAgC,WAAW,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CACtG,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @zudojs/testing — Storage testing helpers.
3
+ *
4
+ * In-memory storage adapter for testing without external dependencies.
5
+ */
6
+ export { InMemoryTestStorage } from "./testStorageMemory.core.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testStorage/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @zudojs/testing — Storage testing helpers.
3
+ *
4
+ * In-memory storage adapter for testing without external dependencies.
5
+ */
6
+ export { InMemoryTestStorage } from "./testStorageMemory.core.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testStorage/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @zudojs/testing — In-memory storage adapter for testing.
3
+ *
4
+ * A simple in-memory key-value store that satisfies the basic
5
+ * cache adapter interface for testing without external dependencies.
6
+ */
7
+ /**
8
+ * In-memory storage adapter for testing.
9
+ *
10
+ * Provides basic get/set/delete/has/clear operations
11
+ * without any external dependencies.
12
+ */
13
+ export declare class InMemoryTestStorage {
14
+ private readonly store;
15
+ /** Get a value by key. */
16
+ get<T = unknown>(key: string): T | null;
17
+ /** Set a value with optional TTL in milliseconds. */
18
+ set(key: string, value: unknown, ttlMs?: number): void;
19
+ /** Delete a value by key. Returns true if deleted. */
20
+ delete(key: string): boolean;
21
+ /** Check if a key exists and is not expired. */
22
+ has(key: string): boolean;
23
+ /** Clear all entries. */
24
+ clear(): void;
25
+ /** Get all keys. */
26
+ keys(): string[];
27
+ /** Get the number of entries. */
28
+ get size(): number;
29
+ }
30
+ //# sourceMappingURL=testStorageMemory.core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testStorageMemory.core.d.ts","sourceRoot":"","sources":["../../src/testStorage/testStorageMemory.core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;;;;GAKG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IAEvD,0BAA0B;IAC1B,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAQtC;IAED,qDAAqD;IACrD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAGrD;IAED,sDAAsD;IACtD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE3B;IAED,gDAAgD;IAChD,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAExB;IAED,yBAAyB;IACzB,KAAK,IAAI,IAAI,CAEZ;IAED,oBAAoB;IACpB,IAAI,IAAI,MAAM,EAAE,CAEf;IAED,iCAAiC;IACjC,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @zudojs/testing — In-memory storage adapter for testing.
3
+ *
4
+ * A simple in-memory key-value store that satisfies the basic
5
+ * cache adapter interface for testing without external dependencies.
6
+ */
7
+ /**
8
+ * In-memory storage adapter for testing.
9
+ *
10
+ * Provides basic get/set/delete/has/clear operations
11
+ * without any external dependencies.
12
+ */
13
+ export class InMemoryTestStorage {
14
+ store = new Map();
15
+ /** Get a value by key. */
16
+ get(key) {
17
+ const entry = this.store.get(key);
18
+ if (!entry)
19
+ return null;
20
+ if (entry.expiresAt && entry.expiresAt < new Date()) {
21
+ this.store.delete(key);
22
+ return null;
23
+ }
24
+ return entry.value;
25
+ }
26
+ /** Set a value with optional TTL in milliseconds. */
27
+ set(key, value, ttlMs) {
28
+ const expiresAt = ttlMs ? new Date(Date.now() + ttlMs) : null;
29
+ this.store.set(key, { value, expiresAt });
30
+ }
31
+ /** Delete a value by key. Returns true if deleted. */
32
+ delete(key) {
33
+ return this.store.delete(key);
34
+ }
35
+ /** Check if a key exists and is not expired. */
36
+ has(key) {
37
+ return this.get(key) !== null;
38
+ }
39
+ /** Clear all entries. */
40
+ clear() {
41
+ this.store.clear();
42
+ }
43
+ /** Get all keys. */
44
+ keys() {
45
+ return [...this.store.keys()];
46
+ }
47
+ /** Get the number of entries. */
48
+ get size() {
49
+ return this.store.size;
50
+ }
51
+ }
52
+ //# sourceMappingURL=testStorageMemory.core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testStorageMemory.core.js","sourceRoot":"","sources":["../../src/testStorage/testStorageMemory.core.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH;;;;;GAKG;AACH,MAAM,OAAO,mBAAmB;IACb,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;IAEvD,0BAA0B;IAC1B,GAAG,CAAc,GAAW;QAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QACxB,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,GAAG,IAAI,IAAI,EAAE,EAAE,CAAC;YACpD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACvB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,KAAK,CAAC,KAAU,CAAC;IAC1B,CAAC;IAED,qDAAqD;IACrD,GAAG,CAAC,GAAW,EAAE,KAAc,EAAE,KAAc;QAC7C,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC9D,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,sDAAsD;IACtD,MAAM,CAAC,GAAW;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED,gDAAgD;IAChD,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;IAChC,CAAC;IAED,yBAAyB;IACzB,KAAK;QACH,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAED,oBAAoB;IACpB,IAAI;QACF,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,iCAAiC;IACjC,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;CACF"}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@zudojs/testing",
3
+ "version": "0.0.1",
4
+ "description": "Test helpers, fixtures, mocks, and utilities for testing Zudojs applications.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "scripts": {
19
+ "build": "tsc -p tsconfig.json",
20
+ "clean": "rm -rf dist",
21
+ "typecheck": "tsc -p tsconfig.json --noEmit",
22
+ "test": "../../node_modules/.bin/vitest run"
23
+ },
24
+ "dependencies": {
25
+ "@zudojs/config": "workspace:*",
26
+ "@zudojs/constants": "workspace:*",
27
+ "@zudojs/container": "workspace:*",
28
+ "@zudojs/errors": "workspace:*",
29
+ "@zudojs/events": "workspace:*",
30
+ "@zudojs/http": "workspace:*",
31
+ "@zudojs/logger": "workspace:*",
32
+ "@zudojs/messaging": "workspace:*",
33
+ "@zudojs/middleware": "workspace:*",
34
+ "@zudojs/queue": "workspace:*",
35
+ "@zudojs/security": "workspace:*",
36
+ "@zudojs/serialization": "workspace:*",
37
+ "@zudojs/storage": "workspace:*",
38
+ "@zudojs/types": "workspace:*",
39
+ "@zudojs/validation": "workspace:*"
40
+ },
41
+ "devDependencies": {
42
+ "typescript": "^7.0.2",
43
+ "vitest": "^4.1.11"
44
+ },
45
+ "engines": {
46
+ "node": ">=24.0.0"
47
+ },
48
+ "license": "MIT",
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "keywords": [
53
+ "zudojs",
54
+ "testing",
55
+ "mocks",
56
+ "fixtures",
57
+ "vitest"
58
+ ],
59
+ "homepage": "https://github.com/oyinlola-tech/zudo#readme",
60
+ "repository": {
61
+ "type": "git",
62
+ "url": "https://github.com/oyinlola-tech/zudo"
63
+ }
64
+ }