@fedify/testing 2.0.0-dev.1875 → 2.0.0-dev.196
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/LICENSE +1 -1
- package/README.md +9 -7
- package/dist/mod.cjs +6 -6
- package/dist/mod.d.cts +2 -2
- package/dist/mod.d.ts +2 -2
- package/dist/mod.js +4 -4
- package/package.json +2 -2
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ interface for unit testing:
|
|
|
40
40
|
|
|
41
41
|
~~~~ typescript
|
|
42
42
|
import { MockFederation } from "@fedify/testing";
|
|
43
|
-
import { Create } from "@fedify/
|
|
43
|
+
import { Create } from "@fedify/vocab";
|
|
44
44
|
|
|
45
45
|
// Create a mock federation
|
|
46
46
|
const federation = new MockFederation<{ userId: string }>();
|
|
@@ -95,10 +95,12 @@ 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
|
-
## Features
|
|
99
98
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
99
|
+
Features
|
|
100
|
+
--------
|
|
101
|
+
|
|
102
|
+
- Track sent activities with metadata
|
|
103
|
+
- Simulate activity reception
|
|
104
|
+
- Configure custom URI templates
|
|
105
|
+
- Test queue-based activity processing
|
|
106
|
+
- Mock document loaders and context loaders
|
package/dist/mod.cjs
CHANGED
|
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
|
|
23
23
|
//#endregion
|
|
24
24
|
const __fedify_fedify_federation = __toESM(require("@fedify/fedify/federation"));
|
|
25
|
-
const
|
|
25
|
+
const __fedify_vocab = __toESM(require("@fedify/vocab"));
|
|
26
26
|
|
|
27
27
|
//#region src/docloader.ts
|
|
28
28
|
const mockDocumentLoader = async (url) => ({
|
|
@@ -75,13 +75,13 @@ function createContext(values) {
|
|
|
75
75
|
}),
|
|
76
76
|
getActorKeyPairs: getActorKeyPairs ?? ((_handle) => Promise.resolve([])),
|
|
77
77
|
lookupObject: lookupObject ?? ((uri, options = {}) => {
|
|
78
|
-
return (0,
|
|
78
|
+
return (0, __fedify_vocab.lookupObject)(uri, {
|
|
79
79
|
documentLoader: options.documentLoader ?? documentLoader ?? mockDocumentLoader,
|
|
80
80
|
contextLoader: options.contextLoader ?? contextLoader ?? mockDocumentLoader
|
|
81
81
|
});
|
|
82
82
|
}),
|
|
83
83
|
traverseCollection: traverseCollection ?? ((collection, options = {}) => {
|
|
84
|
-
return (0,
|
|
84
|
+
return (0, __fedify_vocab.traverseCollection)(collection, {
|
|
85
85
|
documentLoader: options.documentLoader ?? documentLoader ?? mockDocumentLoader,
|
|
86
86
|
contextLoader: options.contextLoader ?? contextLoader ?? mockDocumentLoader
|
|
87
87
|
});
|
|
@@ -171,7 +171,7 @@ function expandUriTemplate(template, values) {
|
|
|
171
171
|
*
|
|
172
172
|
* @example
|
|
173
173
|
* ```typescript
|
|
174
|
-
* import { Create } from "@fedify/
|
|
174
|
+
* import { Create } from "@fedify/vocab";
|
|
175
175
|
* import { createFederation } from "@fedify/testing";
|
|
176
176
|
*
|
|
177
177
|
* // Create a mock federation with contextData
|
|
@@ -428,7 +428,7 @@ var MockFederation = class {
|
|
|
428
428
|
*
|
|
429
429
|
* @example
|
|
430
430
|
* ```typescript
|
|
431
|
-
* import { Create } from "@fedify/
|
|
431
|
+
* import { Create } from "@fedify/vocab";
|
|
432
432
|
* import { createFederation } from "@fedify/testing";
|
|
433
433
|
*
|
|
434
434
|
* // Create a mock federation with contextData
|
|
@@ -470,7 +470,7 @@ function createFederation(options = {}) {
|
|
|
470
470
|
*
|
|
471
471
|
* @example
|
|
472
472
|
* ```typescript
|
|
473
|
-
* import { Person, Create } from "@fedify/
|
|
473
|
+
* import { Person, Create } from "@fedify/vocab";
|
|
474
474
|
* import { createFederation } from "@fedify/testing";
|
|
475
475
|
*
|
|
476
476
|
* // Create a mock federation and context
|
package/dist/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context, Federation, InboxContext, RequestContext } from "@fedify/fedify/federation";
|
|
2
|
-
import { Activity } from "@fedify/
|
|
2
|
+
import { Activity } from "@fedify/vocab";
|
|
3
3
|
|
|
4
4
|
//#region src/context.d.ts
|
|
5
5
|
declare function createContext<TContextData>(values: Partial<Context<TContextData>> & {
|
|
@@ -91,7 +91,7 @@ interface TestFederation<TContextData> extends Omit<Federation<TContextData>, "c
|
|
|
91
91
|
*
|
|
92
92
|
* @example
|
|
93
93
|
* ```typescript
|
|
94
|
-
* import { Create } from "@fedify/
|
|
94
|
+
* import { Create } from "@fedify/vocab";
|
|
95
95
|
* import { createFederation } from "@fedify/testing";
|
|
96
96
|
*
|
|
97
97
|
* // Create a mock federation with contextData
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context, Federation, InboxContext, RequestContext } from "@fedify/fedify/federation";
|
|
2
|
-
import { Activity } from "@fedify/
|
|
2
|
+
import { Activity } from "@fedify/vocab";
|
|
3
3
|
|
|
4
4
|
//#region src/context.d.ts
|
|
5
5
|
declare function createContext<TContextData>(values: Partial<Context<TContextData>> & {
|
|
@@ -91,7 +91,7 @@ interface TestFederation<TContextData> extends Omit<Federation<TContextData>, "c
|
|
|
91
91
|
*
|
|
92
92
|
* @example
|
|
93
93
|
* ```typescript
|
|
94
|
-
* import { Create } from "@fedify/
|
|
94
|
+
* import { Create } from "@fedify/vocab";
|
|
95
95
|
* import { createFederation } from "@fedify/testing";
|
|
96
96
|
*
|
|
97
97
|
* // Create a mock federation with contextData
|
package/dist/mod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RouterError } from "@fedify/fedify/federation";
|
|
2
|
-
import { lookupObject, traverseCollection } from "@fedify/
|
|
2
|
+
import { lookupObject, traverseCollection } from "@fedify/vocab";
|
|
3
3
|
|
|
4
4
|
//#region src/docloader.ts
|
|
5
5
|
const mockDocumentLoader = async (url) => ({
|
|
@@ -148,7 +148,7 @@ function expandUriTemplate(template, values) {
|
|
|
148
148
|
*
|
|
149
149
|
* @example
|
|
150
150
|
* ```typescript
|
|
151
|
-
* import { Create } from "@fedify/
|
|
151
|
+
* import { Create } from "@fedify/vocab";
|
|
152
152
|
* import { createFederation } from "@fedify/testing";
|
|
153
153
|
*
|
|
154
154
|
* // Create a mock federation with contextData
|
|
@@ -405,7 +405,7 @@ var MockFederation = class {
|
|
|
405
405
|
*
|
|
406
406
|
* @example
|
|
407
407
|
* ```typescript
|
|
408
|
-
* import { Create } from "@fedify/
|
|
408
|
+
* import { Create } from "@fedify/vocab";
|
|
409
409
|
* import { createFederation } from "@fedify/testing";
|
|
410
410
|
*
|
|
411
411
|
* // Create a mock federation with contextData
|
|
@@ -447,7 +447,7 @@ function createFederation(options = {}) {
|
|
|
447
447
|
*
|
|
448
448
|
* @example
|
|
449
449
|
* ```typescript
|
|
450
|
-
* import { Person, Create } from "@fedify/
|
|
450
|
+
* import { Person, Create } from "@fedify/vocab";
|
|
451
451
|
* import { createFederation } from "@fedify/testing";
|
|
452
452
|
*
|
|
453
453
|
* // Create a mock federation and context
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/testing",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.196+c3cfc0a9",
|
|
4
4
|
"description": "Testing utilities for Fedify applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"package.json"
|
|
51
51
|
],
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@fedify/fedify": "^2.0.0-dev.
|
|
53
|
+
"@fedify/fedify": "^2.0.0-dev.196+c3cfc0a9"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@js-temporal/polyfill": "^0.5.1",
|