@fedify/testing 2.4.0-pr.936.41 → 2.5.0-dev.2271
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.
- package/README.md +27 -0
- package/dist/mod.cjs +586 -173
- package/dist/mod.d.cts +72 -6
- package/dist/mod.d.ts +72 -6
- package/dist/mod.js +476 -71
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -95,6 +95,33 @@ The package also exports helper functions for creating various context types:
|
|
|
95
95
|
- `createRequestContext()`: Creates a request context
|
|
96
96
|
- `createInboxContext()`: Creates an inbox context
|
|
97
97
|
|
|
98
|
+
### Store conformance tests
|
|
99
|
+
|
|
100
|
+
The package provides reusable conformance suites for Fedify storage adapters.
|
|
101
|
+
Use `testKvStore()` to check a `KvStore` implementation and
|
|
102
|
+
`testMessageQueue()` to check a `MessageQueue` implementation:
|
|
103
|
+
|
|
104
|
+
~~~~ typescript
|
|
105
|
+
import { test } from "@fedify/fixture";
|
|
106
|
+
import { testKvStore, testMessageQueue } from "@fedify/testing";
|
|
107
|
+
|
|
108
|
+
test("MyKvStore", () =>
|
|
109
|
+
testKvStore(
|
|
110
|
+
() => new MyKvStore(),
|
|
111
|
+
async ({ store }) => await store.close(),
|
|
112
|
+
));
|
|
113
|
+
|
|
114
|
+
test("MyMessageQueue", () =>
|
|
115
|
+
testMessageQueue(
|
|
116
|
+
() => new MyMessageQueue(),
|
|
117
|
+
async ({ mq1, mq2, controller }) => {
|
|
118
|
+
controller.abort();
|
|
119
|
+
await mq1.close();
|
|
120
|
+
await mq2.close();
|
|
121
|
+
},
|
|
122
|
+
));
|
|
123
|
+
~~~~
|
|
124
|
+
|
|
98
125
|
|
|
99
126
|
Features
|
|
100
127
|
--------
|