@temporal-contract/testing 0.0.1 → 0.0.2
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 +11 -51
- package/package.json +3 -3
- package/config/sql.yaml +0 -6
package/README.md
CHANGED
|
@@ -1,76 +1,36 @@
|
|
|
1
1
|
# @temporal-contract/testing
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Testing utilities for temporal-contract integration tests
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
- **Testcontainers Integration**: Automatically starts a Temporal server in a Docker container for integration tests
|
|
8
|
-
- **Vitest Setup**: Pre-configured setup for Vitest with global test lifecycle
|
|
9
|
-
- **Connection Management**: Handles Temporal connection setup and cleanup
|
|
5
|
+
[](https://www.npmjs.com/package/@temporal-contract/testing)
|
|
10
6
|
|
|
11
7
|
## Installation
|
|
12
8
|
|
|
13
|
-
This package is internal to the monorepo and used by sample projects for integration testing.
|
|
14
|
-
|
|
15
9
|
```bash
|
|
16
10
|
pnpm add -D @temporal-contract/testing
|
|
17
11
|
```
|
|
18
12
|
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
### In vitest.config.ts
|
|
13
|
+
## Quick Example
|
|
22
14
|
|
|
23
15
|
```typescript
|
|
16
|
+
// vitest.config.ts
|
|
24
17
|
import { defineConfig } from 'vitest/config';
|
|
25
18
|
|
|
26
19
|
export default defineConfig({
|
|
27
20
|
test: {
|
|
28
|
-
globalSetup: '
|
|
21
|
+
globalSetup: '@temporal-contract/testing/global-setup',
|
|
29
22
|
testTimeout: 60000,
|
|
30
23
|
},
|
|
31
24
|
});
|
|
32
25
|
```
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```typescript
|
|
37
|
-
import { setupTemporalTestContainer } from '@temporal-contract/testing';
|
|
38
|
-
|
|
39
|
-
export default setupTemporalTestContainer;
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### In your tests
|
|
43
|
-
|
|
44
|
-
```typescript
|
|
45
|
-
import { describe, it, expect } from 'vitest';
|
|
46
|
-
import { getTemporalConnection } from '@temporal-contract/testing';
|
|
47
|
-
import { TypedClient } from '@temporal-contract/client';
|
|
48
|
-
|
|
49
|
-
describe('Order Processing Workflow', () => {
|
|
50
|
-
it('should process an order successfully', async () => {
|
|
51
|
-
const connection = await getTemporalConnection();
|
|
52
|
-
const client = TypedClient.create(myContract, { connection });
|
|
53
|
-
|
|
54
|
-
// Your test code here
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## API
|
|
60
|
-
|
|
61
|
-
### `setupTemporalTestContainer()`
|
|
62
|
-
|
|
63
|
-
Global setup function that starts a Temporal container before all tests and stops it after all tests.
|
|
64
|
-
|
|
65
|
-
### `getTemporalConnection()`
|
|
66
|
-
|
|
67
|
-
Returns a connection to the Temporal server running in the container.
|
|
27
|
+
## Documentation
|
|
68
28
|
|
|
69
|
-
|
|
29
|
+
📖 **[Read the full documentation →](https://btravers.github.io/temporal-contract)**
|
|
70
30
|
|
|
71
|
-
-
|
|
72
|
-
-
|
|
31
|
+
- [API Reference](https://btravers.github.io/temporal-contract/api/testing)
|
|
32
|
+
- [Examples](https://btravers.github.io/temporal-contract/examples/)
|
|
73
33
|
|
|
74
|
-
##
|
|
34
|
+
## License
|
|
75
35
|
|
|
76
|
-
|
|
36
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporal-contract/testing",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Temporal testing utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./global-setup": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"tsdown": "0.17.2",
|
|
28
28
|
"typescript": "5.9.3",
|
|
29
29
|
"vitest": "4.0.15",
|
|
30
|
-
"@temporal-contract/tsconfig": "0.0.
|
|
30
|
+
"@temporal-contract/tsconfig": "0.0.2"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"vitest": "^4"
|