@fedify/testing 1.8.1-pr.283.1138 → 1.8.1-pr.315.1275
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 +28 -25
- package/dist/mod.d.ts +6 -3
- package/dist/mod.js +27 -6
- package/package.json +10 -6
- package/context.ts +0 -154
- package/deno.json +0 -41
- package/docloader.ts +0 -8
- package/mock.test.ts +0 -361
- package/mock.ts +0 -953
- package/mod.ts +0 -12
- package/tsdown.config.ts +0 -16
package/README.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- deno-fmt-ignore-file -->
|
|
2
|
+
|
|
3
|
+
@fedify/testing
|
|
4
|
+
===============
|
|
2
5
|
|
|
3
6
|
Testing utilities for Fedify applications.
|
|
4
7
|
|
|
@@ -6,32 +9,36 @@ This package provides mock implementations of the `Federation` and `Context`
|
|
|
6
9
|
interfaces to facilitate unit testing of federated applications built with
|
|
7
10
|
Fedify.
|
|
8
11
|
|
|
9
|
-
## Installation
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Installation
|
|
14
|
+
------------
|
|
15
|
+
|
|
16
|
+
~~~~ bash
|
|
12
17
|
deno add @fedify/testing
|
|
13
|
-
|
|
18
|
+
~~~~
|
|
14
19
|
|
|
15
|
-
|
|
20
|
+
~~~~ bash
|
|
16
21
|
npm install @fedify/testing
|
|
17
|
-
|
|
22
|
+
~~~~
|
|
18
23
|
|
|
19
|
-
|
|
24
|
+
~~~~ bash
|
|
20
25
|
pnpm add @fedify/testing
|
|
21
|
-
|
|
26
|
+
~~~~
|
|
22
27
|
|
|
23
|
-
|
|
28
|
+
~~~~ bash
|
|
24
29
|
yarn add @fedify/testing
|
|
25
|
-
|
|
30
|
+
~~~~
|
|
31
|
+
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
Usage
|
|
34
|
+
-----
|
|
28
35
|
|
|
29
|
-
### MockFederation
|
|
36
|
+
### `MockFederation`
|
|
30
37
|
|
|
31
38
|
The `MockFederation` class provides a mock implementation of the `Federation`
|
|
32
39
|
interface for unit testing:
|
|
33
40
|
|
|
34
|
-
|
|
41
|
+
~~~~ typescript
|
|
35
42
|
import { MockFederation } from "@fedify/testing";
|
|
36
43
|
import { Create } from "@fedify/fedify/vocab";
|
|
37
44
|
|
|
@@ -51,14 +58,14 @@ await federation.receiveActivity(createActivity);
|
|
|
51
58
|
// Check sent activities
|
|
52
59
|
const sent = federation.sentActivities;
|
|
53
60
|
console.log(sent[0].activity);
|
|
54
|
-
|
|
61
|
+
~~~~
|
|
55
62
|
|
|
56
|
-
### MockContext
|
|
63
|
+
### `MockContext`
|
|
57
64
|
|
|
58
65
|
The `MockContext` class provides a mock implementation of the `Context`
|
|
59
66
|
interface:
|
|
60
67
|
|
|
61
|
-
|
|
68
|
+
~~~~ typescript
|
|
62
69
|
import { MockContext } from "@fedify/testing";
|
|
63
70
|
|
|
64
71
|
// Create a mock context
|
|
@@ -78,15 +85,15 @@ await context.sendActivity(
|
|
|
78
85
|
// Check sent activities
|
|
79
86
|
const sent = context.getSentActivities();
|
|
80
87
|
console.log(sent[0].activity);
|
|
81
|
-
|
|
88
|
+
~~~~
|
|
82
89
|
|
|
83
|
-
### Helper
|
|
90
|
+
### Helper functions
|
|
84
91
|
|
|
85
92
|
The package also exports helper functions for creating various context types:
|
|
86
93
|
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
94
|
+
- `createContext()`: Creates a basic context
|
|
95
|
+
- `createRequestContext()`: Creates a request context
|
|
96
|
+
- `createInboxContext()`: Creates an inbox context
|
|
90
97
|
|
|
91
98
|
## Features
|
|
92
99
|
|
|
@@ -95,7 +102,3 @@ The package also exports helper functions for creating various context types:
|
|
|
95
102
|
- Configure custom URI templates
|
|
96
103
|
- Test queue-based activity processing
|
|
97
104
|
- Mock document loaders and context loaders
|
|
98
|
-
|
|
99
|
-
## License
|
|
100
|
-
|
|
101
|
-
MIT
|
package/dist/mod.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ResourceDescriptor } from "@fedify/fedify/webfinger";
|
|
|
5
5
|
import { JsonValue, NodeInfo } from "@fedify/fedify/nodeinfo";
|
|
6
6
|
import { DocumentLoader } from "@fedify/fedify/runtime";
|
|
7
7
|
|
|
8
|
-
//#region mock.d.ts
|
|
8
|
+
//#region src/mock.d.ts
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Represents a sent activity with metadata about how it was sent.
|
|
@@ -51,7 +51,7 @@ interface SentActivity {
|
|
|
51
51
|
* await federation.receiveActivity(createActivity);
|
|
52
52
|
* ```
|
|
53
53
|
*
|
|
54
|
-
* @
|
|
54
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
55
55
|
* @since 1.8.0
|
|
56
56
|
*/
|
|
57
57
|
declare class MockFederation<TContextData> implements Federation<TContextData> {
|
|
@@ -124,6 +124,8 @@ declare class MockFederation<TContextData> implements Federation<TContextData> {
|
|
|
124
124
|
* @since 1.8.0
|
|
125
125
|
*/
|
|
126
126
|
reset(): void;
|
|
127
|
+
setCollectionDispatcher<TObject extends Object$1, TParams extends Record<string, string>>(_name: string | symbol, _itemType: any, _path: any, _dispatcher: any): any;
|
|
128
|
+
setOrderedCollectionDispatcher<TObject extends Object$1, TParams extends Record<string, string>>(_name: string | symbol, _itemType: any, _path: any, _dispatcher: any): any;
|
|
127
129
|
}
|
|
128
130
|
/**
|
|
129
131
|
* A mock implementation of the {@link Context} interface for unit testing.
|
|
@@ -160,7 +162,7 @@ declare class MockFederation<TContextData> implements Federation<TContextData> {
|
|
|
160
162
|
* console.log(sent[0].activity);
|
|
161
163
|
* ```
|
|
162
164
|
*
|
|
163
|
-
* @
|
|
165
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
164
166
|
* @since 1.8.0
|
|
165
167
|
*/
|
|
166
168
|
declare class MockContext<TContextData> implements Context<TContextData> {
|
|
@@ -196,6 +198,7 @@ declare class MockContext<TContextData> implements Context<TContextData> {
|
|
|
196
198
|
getLikedUri(identifier: string): URL;
|
|
197
199
|
getFeaturedUri(identifier: string): URL;
|
|
198
200
|
getFeaturedTagsUri(identifier: string): URL;
|
|
201
|
+
getCollectionUri<TParam extends Record<string, string>>(_name: string | symbol, values: TParam): URL;
|
|
199
202
|
parseUri(uri: URL): ParseUriResult | null;
|
|
200
203
|
getActorKeyPairs(_identifier: string): Promise<ActorKeyPair[]>;
|
|
201
204
|
getDocumentLoader(params: {
|
package/dist/mod.js
CHANGED
|
@@ -3,7 +3,7 @@ import { RouterError } from "@fedify/fedify/federation";
|
|
|
3
3
|
import { lookupObject, traverseCollection } from "@fedify/fedify/vocab";
|
|
4
4
|
import { lookupWebFinger } from "@fedify/fedify/webfinger";
|
|
5
5
|
|
|
6
|
-
//#region docloader.ts
|
|
6
|
+
//#region src/docloader.ts
|
|
7
7
|
const mockDocumentLoader = async (url) => ({
|
|
8
8
|
contextUrl: null,
|
|
9
9
|
document: {},
|
|
@@ -11,9 +11,9 @@ const mockDocumentLoader = async (url) => ({
|
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
//#endregion
|
|
14
|
-
//#region context.ts
|
|
14
|
+
//#region src/context.ts
|
|
15
15
|
function createContext(values) {
|
|
16
|
-
const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getOutboxUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject: lookupObject$1, traverseCollection: traverseCollection$1, lookupNodeInfo, lookupWebFinger: lookupWebFinger$1, sendActivity, routeActivity } = values;
|
|
16
|
+
const { federation, url = new URL("http://example.com/"), canonicalOrigin, data, documentLoader, contextLoader, tracerProvider, clone, getNodeInfoUri, getActorUri, getObjectUri, getCollectionUri, getOutboxUri, getInboxUri, getFollowingUri, getFollowersUri, getLikedUri, getFeaturedUri, getFeaturedTagsUri, parseUri, getActorKeyPairs, getDocumentLoader, lookupObject: lookupObject$1, traverseCollection: traverseCollection$1, lookupNodeInfo, lookupWebFinger: lookupWebFinger$1, sendActivity, routeActivity } = values;
|
|
17
17
|
function throwRouteError() {
|
|
18
18
|
throw new RouterError("Not implemented");
|
|
19
19
|
}
|
|
@@ -34,6 +34,7 @@ function createContext(values) {
|
|
|
34
34
|
getNodeInfoUri: getNodeInfoUri ?? throwRouteError,
|
|
35
35
|
getActorUri: getActorUri ?? throwRouteError,
|
|
36
36
|
getObjectUri: getObjectUri ?? throwRouteError,
|
|
37
|
+
getCollectionUri: getCollectionUri ?? throwRouteError,
|
|
37
38
|
getOutboxUri: getOutboxUri ?? throwRouteError,
|
|
38
39
|
getInboxUri: getInboxUri ?? throwRouteError,
|
|
39
40
|
getFollowingUri: getFollowingUri ?? throwRouteError,
|
|
@@ -107,7 +108,7 @@ function createInboxContext(args) {
|
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
//#endregion
|
|
110
|
-
//#region mock.ts
|
|
111
|
+
//#region src/mock.ts
|
|
111
112
|
/**
|
|
112
113
|
* Helper function to expand URI templates with values.
|
|
113
114
|
* Supports simple placeholders like {identifier}, {handle}, etc.
|
|
@@ -150,7 +151,7 @@ function expandUriTemplate(template, values) {
|
|
|
150
151
|
* await federation.receiveActivity(createActivity);
|
|
151
152
|
* ```
|
|
152
153
|
*
|
|
153
|
-
* @
|
|
154
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
154
155
|
* @since 1.8.0
|
|
155
156
|
*/
|
|
156
157
|
var MockFederation = class {
|
|
@@ -363,6 +364,22 @@ var MockFederation = class {
|
|
|
363
364
|
reset() {
|
|
364
365
|
this.sentActivities = [];
|
|
365
366
|
}
|
|
367
|
+
setCollectionDispatcher(_name, _itemType, _path, _dispatcher) {
|
|
368
|
+
return {
|
|
369
|
+
setCounter: () => this,
|
|
370
|
+
setFirstCursor: () => this,
|
|
371
|
+
setLastCursor: () => this,
|
|
372
|
+
authorize: () => this
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
setOrderedCollectionDispatcher(_name, _itemType, _path, _dispatcher) {
|
|
376
|
+
return {
|
|
377
|
+
setCounter: () => this,
|
|
378
|
+
setFirstCursor: () => this,
|
|
379
|
+
setLastCursor: () => this,
|
|
380
|
+
authorize: () => this
|
|
381
|
+
};
|
|
382
|
+
}
|
|
366
383
|
};
|
|
367
384
|
/**
|
|
368
385
|
* A mock implementation of the {@link Context} interface for unit testing.
|
|
@@ -399,7 +416,7 @@ var MockFederation = class {
|
|
|
399
416
|
* console.log(sent[0].activity);
|
|
400
417
|
* ```
|
|
401
418
|
*
|
|
402
|
-
* @
|
|
419
|
+
* @template TContextData The context data to pass to the {@link Context}.
|
|
403
420
|
* @since 1.8.0
|
|
404
421
|
*/
|
|
405
422
|
var MockContext = class MockContext {
|
|
@@ -538,6 +555,10 @@ var MockContext = class MockContext {
|
|
|
538
555
|
}
|
|
539
556
|
return new URL(`/users/${identifier}/tags`, this.origin);
|
|
540
557
|
}
|
|
558
|
+
getCollectionUri(_name, values) {
|
|
559
|
+
const path = globalThis.Object.entries(values).map(([key, value]) => `${key}/${value}`).join("/");
|
|
560
|
+
return new URL(`/collections/${String(_name)}/${path}`, this.origin);
|
|
561
|
+
}
|
|
541
562
|
parseUri(uri) {
|
|
542
563
|
if (uri.pathname.startsWith("/users/")) {
|
|
543
564
|
const parts = uri.pathname.split("/");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/testing",
|
|
3
|
-
"version": "1.8.1-pr.
|
|
3
|
+
"version": "1.8.1-pr.315.1275+37d811f6",
|
|
4
4
|
"description": "Testing utilities for Fedify applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
21
|
"url": "git+https://github.com/fedify-dev/fedify.git",
|
|
22
|
-
"directory": "testing"
|
|
22
|
+
"directory": "packages/testing"
|
|
23
23
|
},
|
|
24
24
|
"bugs": {
|
|
25
25
|
"url": "https://github.com/fedify-dev/fedify/issues"
|
|
@@ -40,8 +40,15 @@
|
|
|
40
40
|
},
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
|
+
"files": [
|
|
44
|
+
"dist",
|
|
45
|
+
"package.json"
|
|
46
|
+
],
|
|
43
47
|
"peerDependencies": {
|
|
44
|
-
"@fedify/fedify": "1.8.1-pr.
|
|
48
|
+
"@fedify/fedify": "1.8.1-pr.315.1275+37d811f6"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@opentelemetry/api": "^1.9.0"
|
|
45
52
|
},
|
|
46
53
|
"devDependencies": {
|
|
47
54
|
"@js-temporal/polyfill": "^0.5.1",
|
|
@@ -50,9 +57,6 @@
|
|
|
50
57
|
"tsdown": "^0.12.9",
|
|
51
58
|
"typescript": "^5.8.3"
|
|
52
59
|
},
|
|
53
|
-
"dependencies": {
|
|
54
|
-
"@opentelemetry/api": "^1.9.0"
|
|
55
|
-
},
|
|
56
60
|
"scripts": {
|
|
57
61
|
"build": "tsdown",
|
|
58
62
|
"prepublish": "tsdown",
|
package/context.ts
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { trace } from "@opentelemetry/api";
|
|
2
|
-
import type {
|
|
3
|
-
Context,
|
|
4
|
-
InboxContext,
|
|
5
|
-
RequestContext,
|
|
6
|
-
} from "@fedify/fedify/federation";
|
|
7
|
-
import type { Federation } from "@fedify/fedify/federation";
|
|
8
|
-
import { RouterError } from "@fedify/fedify/federation";
|
|
9
|
-
import {
|
|
10
|
-
lookupObject as globalLookupObject,
|
|
11
|
-
traverseCollection as globalTraverseCollection,
|
|
12
|
-
} from "@fedify/fedify/vocab";
|
|
13
|
-
import { lookupWebFinger as globalLookupWebFinger } from "@fedify/fedify/webfinger";
|
|
14
|
-
import { mockDocumentLoader } from "./docloader.ts";
|
|
15
|
-
|
|
16
|
-
// NOTE: Copied from @fedify/fedify/testing/context.ts
|
|
17
|
-
|
|
18
|
-
export function createContext<TContextData>(
|
|
19
|
-
values: Partial<Context<TContextData>> & {
|
|
20
|
-
url?: URL;
|
|
21
|
-
data: TContextData;
|
|
22
|
-
federation: Federation<TContextData>;
|
|
23
|
-
},
|
|
24
|
-
): Context<TContextData> {
|
|
25
|
-
const {
|
|
26
|
-
federation,
|
|
27
|
-
url = new URL("http://example.com/"),
|
|
28
|
-
canonicalOrigin,
|
|
29
|
-
data,
|
|
30
|
-
documentLoader,
|
|
31
|
-
contextLoader,
|
|
32
|
-
tracerProvider,
|
|
33
|
-
clone,
|
|
34
|
-
getNodeInfoUri,
|
|
35
|
-
getActorUri,
|
|
36
|
-
getObjectUri,
|
|
37
|
-
getOutboxUri,
|
|
38
|
-
getInboxUri,
|
|
39
|
-
getFollowingUri,
|
|
40
|
-
getFollowersUri,
|
|
41
|
-
getLikedUri,
|
|
42
|
-
getFeaturedUri,
|
|
43
|
-
getFeaturedTagsUri,
|
|
44
|
-
parseUri,
|
|
45
|
-
getActorKeyPairs,
|
|
46
|
-
getDocumentLoader,
|
|
47
|
-
lookupObject,
|
|
48
|
-
traverseCollection,
|
|
49
|
-
lookupNodeInfo,
|
|
50
|
-
lookupWebFinger,
|
|
51
|
-
sendActivity,
|
|
52
|
-
routeActivity,
|
|
53
|
-
} = values;
|
|
54
|
-
function throwRouteError(): URL {
|
|
55
|
-
throw new RouterError("Not implemented");
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
federation,
|
|
59
|
-
data,
|
|
60
|
-
origin: url.origin,
|
|
61
|
-
canonicalOrigin: canonicalOrigin ?? url.origin,
|
|
62
|
-
host: url.host,
|
|
63
|
-
hostname: url.hostname,
|
|
64
|
-
documentLoader: documentLoader ?? mockDocumentLoader,
|
|
65
|
-
contextLoader: contextLoader ?? mockDocumentLoader,
|
|
66
|
-
tracerProvider: tracerProvider ?? trace.getTracerProvider(),
|
|
67
|
-
clone: clone ?? ((data) => createContext({ ...values, data })),
|
|
68
|
-
getNodeInfoUri: getNodeInfoUri ?? throwRouteError,
|
|
69
|
-
getActorUri: getActorUri ?? throwRouteError,
|
|
70
|
-
getObjectUri: getObjectUri ?? throwRouteError,
|
|
71
|
-
getOutboxUri: getOutboxUri ?? throwRouteError,
|
|
72
|
-
getInboxUri: getInboxUri ?? throwRouteError,
|
|
73
|
-
getFollowingUri: getFollowingUri ?? throwRouteError,
|
|
74
|
-
getFollowersUri: getFollowersUri ?? throwRouteError,
|
|
75
|
-
getLikedUri: getLikedUri ?? throwRouteError,
|
|
76
|
-
getFeaturedUri: getFeaturedUri ?? throwRouteError,
|
|
77
|
-
getFeaturedTagsUri: getFeaturedTagsUri ?? throwRouteError,
|
|
78
|
-
parseUri: parseUri ?? ((_uri) => {
|
|
79
|
-
throw new Error("Not implemented");
|
|
80
|
-
}),
|
|
81
|
-
getDocumentLoader: getDocumentLoader ?? ((_params) => {
|
|
82
|
-
throw new Error("Not implemented");
|
|
83
|
-
}),
|
|
84
|
-
getActorKeyPairs: getActorKeyPairs ?? ((_handle) => Promise.resolve([])),
|
|
85
|
-
lookupObject: lookupObject ?? ((uri, options = {}) => {
|
|
86
|
-
return globalLookupObject(uri, {
|
|
87
|
-
documentLoader: options.documentLoader ?? documentLoader ??
|
|
88
|
-
mockDocumentLoader,
|
|
89
|
-
contextLoader: options.contextLoader ?? contextLoader ??
|
|
90
|
-
mockDocumentLoader,
|
|
91
|
-
});
|
|
92
|
-
}),
|
|
93
|
-
traverseCollection: traverseCollection ?? ((collection, options = {}) => {
|
|
94
|
-
return globalTraverseCollection(collection, {
|
|
95
|
-
documentLoader: options.documentLoader ?? documentLoader ??
|
|
96
|
-
mockDocumentLoader,
|
|
97
|
-
contextLoader: options.contextLoader ?? contextLoader ??
|
|
98
|
-
mockDocumentLoader,
|
|
99
|
-
});
|
|
100
|
-
}),
|
|
101
|
-
lookupNodeInfo: lookupNodeInfo ?? ((_params) => {
|
|
102
|
-
throw new Error("Not implemented");
|
|
103
|
-
}),
|
|
104
|
-
lookupWebFinger: lookupWebFinger ?? ((resource, options = {}) => {
|
|
105
|
-
return globalLookupWebFinger(resource, options);
|
|
106
|
-
}),
|
|
107
|
-
sendActivity: sendActivity ?? ((_params) => {
|
|
108
|
-
throw new Error("Not implemented");
|
|
109
|
-
}),
|
|
110
|
-
routeActivity: routeActivity ?? ((_params) => {
|
|
111
|
-
throw new Error("Not implemented");
|
|
112
|
-
}),
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export function createRequestContext<TContextData>(
|
|
117
|
-
args: Partial<RequestContext<TContextData>> & {
|
|
118
|
-
url: URL;
|
|
119
|
-
data: TContextData;
|
|
120
|
-
federation: Federation<TContextData>;
|
|
121
|
-
},
|
|
122
|
-
): RequestContext<TContextData> {
|
|
123
|
-
return {
|
|
124
|
-
...createContext(args),
|
|
125
|
-
clone: args.clone ?? ((data) => createRequestContext({ ...args, data })),
|
|
126
|
-
request: args.request ?? new Request(args.url),
|
|
127
|
-
url: args.url,
|
|
128
|
-
getActor: args.getActor ?? (() => Promise.resolve(null)),
|
|
129
|
-
getObject: args.getObject ?? (() => Promise.resolve(null)),
|
|
130
|
-
getSignedKey: args.getSignedKey ?? (() => Promise.resolve(null)),
|
|
131
|
-
getSignedKeyOwner: args.getSignedKeyOwner ?? (() => Promise.resolve(null)),
|
|
132
|
-
sendActivity: args.sendActivity ?? ((_params) => {
|
|
133
|
-
throw new Error("Not implemented");
|
|
134
|
-
}),
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export function createInboxContext<TContextData>(
|
|
139
|
-
args: Partial<InboxContext<TContextData>> & {
|
|
140
|
-
url?: URL;
|
|
141
|
-
data: TContextData;
|
|
142
|
-
recipient?: string | null;
|
|
143
|
-
federation: Federation<TContextData>;
|
|
144
|
-
},
|
|
145
|
-
): InboxContext<TContextData> {
|
|
146
|
-
return {
|
|
147
|
-
...createContext(args),
|
|
148
|
-
clone: args.clone ?? ((data) => createInboxContext({ ...args, data })),
|
|
149
|
-
recipient: args.recipient ?? null,
|
|
150
|
-
forwardActivity: args.forwardActivity ?? ((_params) => {
|
|
151
|
-
throw new Error("Not implemented");
|
|
152
|
-
}),
|
|
153
|
-
};
|
|
154
|
-
}
|
package/deno.json
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@fedify/testing",
|
|
3
|
-
"version": "1.8.1-pr.283.1138+8009e193",
|
|
4
|
-
"license": "MIT",
|
|
5
|
-
"exports": {
|
|
6
|
-
".": "./mod.ts"
|
|
7
|
-
},
|
|
8
|
-
"imports": {
|
|
9
|
-
"@opentelemetry/api": "npm:@opentelemetry/api@^1.9.0"
|
|
10
|
-
},
|
|
11
|
-
"exclude": [
|
|
12
|
-
".github",
|
|
13
|
-
"node_modules",
|
|
14
|
-
"npm",
|
|
15
|
-
"pnpm-lock.yaml"
|
|
16
|
-
],
|
|
17
|
-
"tasks": {
|
|
18
|
-
"build": "pnpm build",
|
|
19
|
-
"check": "deno fmt --check && deno lint && deno check mod.ts",
|
|
20
|
-
"test": "deno test --allow-read --allow-net",
|
|
21
|
-
"test:node": {
|
|
22
|
-
"dependencies": [
|
|
23
|
-
"build"
|
|
24
|
-
],
|
|
25
|
-
"command": "node --experimental-transform-types --test"
|
|
26
|
-
},
|
|
27
|
-
"test:bun": {
|
|
28
|
-
"dependencies": [
|
|
29
|
-
"build"
|
|
30
|
-
],
|
|
31
|
-
"command": "bun test --timeout 15000"
|
|
32
|
-
},
|
|
33
|
-
"test-all": {
|
|
34
|
-
"dependencies": [
|
|
35
|
-
"test",
|
|
36
|
-
"test:node",
|
|
37
|
-
"test:bun"
|
|
38
|
-
]
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
package/docloader.ts
DELETED