@thymian/core-testing 0.0.2 → 0.0.3-canary.20260125-996434f
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 +22 -18
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Thymian
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Add resilience and HTTP conformance to your API development workflow. Thymian is a lightweight, language-agnostic library that helps you build robust APIs.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## @thymian/core-testing
|
|
6
6
|
|
|
7
7
|
`@thymian/core-testing` provides reusable testing utilities that make it easy to write tests for Thymian plugins and components. It includes:
|
|
8
8
|
|
|
@@ -16,7 +16,7 @@ Testing utilities, factories, and mocks for the Thymian plugin ecosystem.
|
|
|
16
16
|
npm install --save-dev @thymian/core-testing
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
### Quick Start
|
|
20
20
|
|
|
21
21
|
```typescript
|
|
22
22
|
import { createHttpRequest, createHttpResponse, createMockLogger, createMockEmitter, createMockPlugin } from '@thymian/core-testing';
|
|
@@ -37,11 +37,11 @@ expect(logger.info).toHaveBeenCalled();
|
|
|
37
37
|
expect(emitter.emit).toHaveBeenCalledWith('core.register', expect.any(Object));
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
### API Reference
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
#### Factories
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
##### Schema Factories
|
|
45
45
|
|
|
46
46
|
Create ThymianSchema objects with sensible defaults:
|
|
47
47
|
|
|
@@ -63,7 +63,7 @@ const objectSchema = createObjectSchema({
|
|
|
63
63
|
const arraySchema = createArraySchema(createStringSchema());
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
##### Parameter Factories
|
|
67
67
|
|
|
68
68
|
Create Parameter objects:
|
|
69
69
|
|
|
@@ -80,7 +80,7 @@ const requiredParam = createRequiredParameter({
|
|
|
80
80
|
});
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
##### HTTP Request Factories
|
|
84
84
|
|
|
85
85
|
Create ThymianHttpRequest objects:
|
|
86
86
|
|
|
@@ -103,7 +103,7 @@ const postRequest = createPostRequest({
|
|
|
103
103
|
});
|
|
104
104
|
```
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
##### HTTP Response Factories
|
|
107
107
|
|
|
108
108
|
Create ThymianHttpResponse objects:
|
|
109
109
|
|
|
@@ -122,7 +122,7 @@ const errorResponse = createNotFoundResponse({
|
|
|
122
122
|
});
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
##### ThymianFormat Factories
|
|
126
126
|
|
|
127
127
|
Create ThymianFormat instances:
|
|
128
128
|
|
|
@@ -145,9 +145,9 @@ const formatWithMany = createThymianFormatWithTransactions([
|
|
|
145
145
|
const formatWithSpecificNumber = createThymianFormatWithTransactions(10);
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
#### Mocks
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
##### Logger Mock
|
|
151
151
|
|
|
152
152
|
Create mock Logger instances:
|
|
153
153
|
|
|
@@ -167,7 +167,7 @@ expect(verboseLogger.verbose).toBe(true);
|
|
|
167
167
|
const silentLogger = createSilentMockLogger();
|
|
168
168
|
```
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
##### Emitter Mock
|
|
171
171
|
|
|
172
172
|
Create mock ThymianEmitter instances:
|
|
173
173
|
|
|
@@ -192,7 +192,7 @@ expect(events).toHaveLength(1);
|
|
|
192
192
|
expect(events[0][0]).toBe('core.register');
|
|
193
193
|
```
|
|
194
194
|
|
|
195
|
-
|
|
195
|
+
##### Plugin Mock
|
|
196
196
|
|
|
197
197
|
Create mock ThymianPlugin instances:
|
|
198
198
|
|
|
@@ -227,9 +227,9 @@ const pluginWithMeta = createPluginWithMetadata({
|
|
|
227
227
|
});
|
|
228
228
|
```
|
|
229
229
|
|
|
230
|
-
|
|
230
|
+
### Examples
|
|
231
231
|
|
|
232
|
-
|
|
232
|
+
#### Testing a Plugin
|
|
233
233
|
|
|
234
234
|
```typescript
|
|
235
235
|
import { describe, it, expect } from 'vitest';
|
|
@@ -262,7 +262,7 @@ describe('myPlugin', () => {
|
|
|
262
262
|
});
|
|
263
263
|
```
|
|
264
264
|
|
|
265
|
-
|
|
265
|
+
#### Testing Format Transformations
|
|
266
266
|
|
|
267
267
|
```typescript
|
|
268
268
|
import { describe, it, expect } from 'vitest';
|
|
@@ -283,3 +283,7 @@ describe('transformFormat', () => {
|
|
|
283
283
|
});
|
|
284
284
|
});
|
|
285
285
|
```
|
|
286
|
+
|
|
287
|
+
## Documentation
|
|
288
|
+
|
|
289
|
+
For comprehensive documentation, visit [Thymian Documentation](https://thymian.dev/).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thymian/core-testing",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-canary.20260125-996434f",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "restricted"
|
|
6
6
|
},
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"tslib": "^2.3.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@thymian/core": "0.0.
|
|
31
|
+
"@thymian/core": "0.0.3-canary.20260125-996434f"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@thymian/core": "0.0.
|
|
34
|
+
"@thymian/core": "0.0.3-canary.20260125-996434f"
|
|
35
35
|
}
|
|
36
36
|
}
|