@fedify/testing 1.8.1-pr.283.1138 → 1.8.1-pr.328.1165
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/deno.json +1 -1
- package/package.json +2 -2
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/deno.json
CHANGED
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.328.1165+9356087c",
|
|
4
4
|
"description": "Testing utilities for Fedify applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fedify",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"./package.json": "./package.json"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@fedify/fedify": "1.8.1-pr.
|
|
44
|
+
"@fedify/fedify": "1.8.1-pr.328.1165+9356087c"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@js-temporal/polyfill": "^0.5.1",
|