@olane/o-test 0.7.12

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.
Files changed (60) hide show
  1. package/LICENSE +33 -0
  2. package/README.md +400 -0
  3. package/dist/src/builders/index.d.ts +7 -0
  4. package/dist/src/builders/index.d.ts.map +1 -0
  5. package/dist/src/builders/index.js +6 -0
  6. package/dist/src/builders/leader-child-builder.d.ts +50 -0
  7. package/dist/src/builders/leader-child-builder.d.ts.map +1 -0
  8. package/dist/src/builders/leader-child-builder.js +59 -0
  9. package/dist/src/builders/manager-worker-builder.d.ts +49 -0
  10. package/dist/src/builders/manager-worker-builder.d.ts.map +1 -0
  11. package/dist/src/builders/manager-worker-builder.js +79 -0
  12. package/dist/src/builders/simple-node-builder.d.ts +49 -0
  13. package/dist/src/builders/simple-node-builder.d.ts.map +1 -0
  14. package/dist/src/builders/simple-node-builder.js +66 -0
  15. package/dist/src/example-tool.tool.d.ts +58 -0
  16. package/dist/src/example-tool.tool.d.ts.map +1 -0
  17. package/dist/src/example-tool.tool.js +89 -0
  18. package/dist/src/fixtures/index.d.ts +6 -0
  19. package/dist/src/fixtures/index.d.ts.map +1 -0
  20. package/dist/src/fixtures/index.js +5 -0
  21. package/dist/src/fixtures/mock-data.d.ts +201 -0
  22. package/dist/src/fixtures/mock-data.d.ts.map +1 -0
  23. package/dist/src/fixtures/mock-data.js +180 -0
  24. package/dist/src/fixtures/test-methods.d.ts +33 -0
  25. package/dist/src/fixtures/test-methods.d.ts.map +1 -0
  26. package/dist/src/fixtures/test-methods.js +185 -0
  27. package/dist/src/index.d.ts +18 -0
  28. package/dist/src/index.d.ts.map +1 -0
  29. package/dist/src/index.js +25 -0
  30. package/dist/src/methods/example.methods.d.ts +9 -0
  31. package/dist/src/methods/example.methods.d.ts.map +1 -0
  32. package/dist/src/methods/example.methods.js +50 -0
  33. package/dist/src/test-environment.d.ts +185 -0
  34. package/dist/src/test-environment.d.ts.map +1 -0
  35. package/dist/src/test-environment.js +260 -0
  36. package/dist/src/utils/assertions.d.ts +159 -0
  37. package/dist/src/utils/assertions.d.ts.map +1 -0
  38. package/dist/src/utils/assertions.js +201 -0
  39. package/dist/src/utils/chunk-capture.d.ts +108 -0
  40. package/dist/src/utils/chunk-capture.d.ts.map +1 -0
  41. package/dist/src/utils/chunk-capture.js +156 -0
  42. package/dist/src/utils/index.d.ts +8 -0
  43. package/dist/src/utils/index.d.ts.map +1 -0
  44. package/dist/src/utils/index.js +7 -0
  45. package/dist/src/utils/mock-factories.d.ts +211 -0
  46. package/dist/src/utils/mock-factories.d.ts.map +1 -0
  47. package/dist/src/utils/mock-factories.js +181 -0
  48. package/dist/src/utils/wait-for.d.ts +42 -0
  49. package/dist/src/utils/wait-for.d.ts.map +1 -0
  50. package/dist/src/utils/wait-for.js +59 -0
  51. package/dist/test/example.spec.d.ts +1 -0
  52. package/dist/test/example.spec.d.ts.map +1 -0
  53. package/dist/test/example.spec.js +240 -0
  54. package/dist/test/fixtures/mock-data.d.ts +1 -0
  55. package/dist/test/fixtures/mock-data.d.ts.map +1 -0
  56. package/dist/test/fixtures/mock-data.js +90 -0
  57. package/dist/test/test-environment.spec.d.ts +8 -0
  58. package/dist/test/test-environment.spec.d.ts.map +1 -0
  59. package/dist/test/test-environment.spec.js +393 -0
  60. package/package.json +87 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-methods.d.ts","sourceRoot":"","sources":["../../../src/fixtures/test-methods.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,OAwBhC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,OAqCjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,OAiCpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAqDlD,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAE/D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,UAAU,GAAE,GAAG,EAAO,GACrB,OAAO,CAOT"}
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Test method definitions for testing
3
+ *
4
+ * Provides sample oMethod definitions for testing tools
5
+ */
6
+ /**
7
+ * Simple test method definition
8
+ */
9
+ export const TEST_METHOD_SIMPLE = {
10
+ name: 'test_method',
11
+ description: 'Simple test method for unit testing',
12
+ parameters: [
13
+ {
14
+ name: 'param1',
15
+ type: 'string',
16
+ description: 'First parameter',
17
+ required: true,
18
+ exampleValues: ['test-value'],
19
+ },
20
+ ],
21
+ dependencies: [],
22
+ examples: [
23
+ {
24
+ description: 'Basic usage',
25
+ intent: 'Test the basic functionality',
26
+ params: { param1: 'test' },
27
+ expectedResult: {
28
+ success: true,
29
+ result: { data: { param1: 'test' } },
30
+ },
31
+ },
32
+ ],
33
+ };
34
+ /**
35
+ * Method with multiple parameters and types
36
+ */
37
+ export const TEST_METHOD_COMPLEX = {
38
+ name: 'test_complex',
39
+ description: 'Complex test method with multiple parameter types',
40
+ parameters: [
41
+ {
42
+ name: 'stringParam',
43
+ type: 'string',
44
+ description: 'String parameter',
45
+ required: true,
46
+ },
47
+ {
48
+ name: 'numberParam',
49
+ type: 'number',
50
+ description: 'Number parameter',
51
+ required: true,
52
+ },
53
+ {
54
+ name: 'booleanParam',
55
+ type: 'boolean',
56
+ description: 'Boolean parameter',
57
+ required: false,
58
+ defaultValue: false,
59
+ },
60
+ {
61
+ name: 'arrayParam',
62
+ type: 'array',
63
+ description: 'Array of strings',
64
+ required: false,
65
+ structure: {
66
+ arrayItems: {
67
+ name: 'item',
68
+ type: 'string',
69
+ },
70
+ },
71
+ },
72
+ ],
73
+ dependencies: [],
74
+ };
75
+ /**
76
+ * Method with validation and errors
77
+ */
78
+ export const TEST_METHOD_VALIDATION = {
79
+ name: 'test_validation',
80
+ description: 'Test method with strict validation',
81
+ parameters: [
82
+ {
83
+ name: 'email',
84
+ type: 'string',
85
+ description: 'Valid email address',
86
+ required: true,
87
+ exampleValues: ['test@example.com'],
88
+ },
89
+ {
90
+ name: 'age',
91
+ type: 'number',
92
+ description: 'Age must be >= 0',
93
+ required: true,
94
+ },
95
+ ],
96
+ dependencies: [],
97
+ commonErrors: [
98
+ {
99
+ errorCode: 'INVALID_EMAIL',
100
+ message: 'Email format is invalid',
101
+ causes: ['Invalid email format provided'],
102
+ remediation: 'Provide a valid email address',
103
+ },
104
+ {
105
+ errorCode: 'INVALID_AGE',
106
+ message: 'Age must be >= 0',
107
+ causes: ['Negative age value provided'],
108
+ remediation: 'Provide a non-negative age',
109
+ },
110
+ ],
111
+ };
112
+ /**
113
+ * Collection of test methods
114
+ */
115
+ export const TEST_METHODS = {
116
+ test_echo: {
117
+ name: 'test_echo',
118
+ description: 'Echo back the input parameters',
119
+ parameters: [
120
+ {
121
+ name: 'message',
122
+ type: 'string',
123
+ description: 'Message to echo',
124
+ required: true,
125
+ },
126
+ ],
127
+ dependencies: [],
128
+ },
129
+ test_add: {
130
+ name: 'test_add',
131
+ description: 'Add two numbers',
132
+ parameters: [
133
+ {
134
+ name: 'a',
135
+ type: 'number',
136
+ description: 'First number',
137
+ required: true,
138
+ },
139
+ {
140
+ name: 'b',
141
+ type: 'number',
142
+ description: 'Second number',
143
+ required: true,
144
+ },
145
+ ],
146
+ dependencies: [],
147
+ },
148
+ test_error: {
149
+ name: 'test_error',
150
+ description: 'Always throws an error (for testing error handling)',
151
+ parameters: [],
152
+ dependencies: [],
153
+ },
154
+ test_timeout: {
155
+ name: 'test_timeout',
156
+ description: 'Simulates a timeout',
157
+ parameters: [
158
+ {
159
+ name: 'delay',
160
+ type: 'number',
161
+ description: 'Delay in milliseconds',
162
+ required: false,
163
+ defaultValue: 5000,
164
+ },
165
+ ],
166
+ dependencies: [],
167
+ },
168
+ };
169
+ /**
170
+ * Get a test method definition by name
171
+ */
172
+ export function getTestMethod(name) {
173
+ return TEST_METHODS[name];
174
+ }
175
+ /**
176
+ * Create a custom test method
177
+ */
178
+ export function createTestMethod(name, description, parameters = []) {
179
+ return {
180
+ name,
181
+ description,
182
+ parameters,
183
+ dependencies: [],
184
+ };
185
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @olane/o-test - Testing utilities for O-Network nodes
3
+ *
4
+ * Provides comprehensive testing utilities, builders, and fixtures
5
+ * to eliminate boilerplate in O-Network package tests.
6
+ */
7
+ export { TestEnvironment } from './test-environment.js';
8
+ export type { TestNodeConfig, LeaderNodeOptions, ToolWithLeaderResult, } from './test-environment.js';
9
+ export { SimpleNodeBuilder, LeaderChildBuilder, ManagerWorkerBuilder, } from './builders/index.js';
10
+ export type { LeaderConfig, ManagerWorkerResult } from './builders/index.js';
11
+ export { waitFor, waitForAsync, sleep, ChunkCapture, assertSuccess, assertError, assertRunning, assertStopped, assertHasData, assertDefined, assertArrayLength, assertHasProperty, assertOneOf, assert, generateId, createMockUser, createMockTask, createMockSession, createMockRequest, createMockSuccessResponse, createMockErrorResponse, generateMockArray, } from './utils/index.js';
12
+ export { INVALID_PARAMS, VALID_PARAMS, } from './utils/mock-factories.js';
13
+ export { MOCK_USERS, MOCK_TASKS, MOCK_SESSIONS, MOCK_CONFIGS, MOCK_ADDRESSES, MOCK_ERRORS, MOCK_STREAM_CHUNKS, TEST_METHOD_SIMPLE, TEST_METHOD_COMPLEX, TEST_METHOD_VALIDATION, TEST_METHODS, getTestMethod, createTestMethod, } from './fixtures/index.js';
14
+ export { INVALID_PARAMS as FIXTURE_INVALID_PARAMS } from './fixtures/mock-data.js';
15
+ export { VALID_PARAMS as FIXTURE_VALID_PARAMS } from './fixtures/mock-data.js';
16
+ export * from './example-tool.tool.js';
17
+ export * from './methods/example.methods.js';
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG7E,OAAO,EACL,OAAO,EACP,YAAY,EACZ,KAAK,EACL,YAAY,EAEZ,aAAa,EACb,WAAW,EACX,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,MAAM,EAEN,UAAU,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,yBAAyB,EACzB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACL,cAAc,EACd,YAAY,GACb,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EACL,UAAU,EACV,UAAU,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,aAAa,EACb,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,cAAc,IAAI,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,YAAY,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG/E,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @olane/o-test - Testing utilities for O-Network nodes
3
+ *
4
+ * Provides comprehensive testing utilities, builders, and fixtures
5
+ * to eliminate boilerplate in O-Network package tests.
6
+ */
7
+ // Core test environment
8
+ export { TestEnvironment } from './test-environment.js';
9
+ // Test builders
10
+ export { SimpleNodeBuilder, LeaderChildBuilder, ManagerWorkerBuilder, } from './builders/index.js';
11
+ // Utilities
12
+ export { waitFor, waitForAsync, sleep, ChunkCapture,
13
+ // Assertions
14
+ assertSuccess, assertError, assertRunning, assertStopped, assertHasData, assertDefined, assertArrayLength, assertHasProperty, assertOneOf, assert,
15
+ // Mock factories
16
+ generateId, createMockUser, createMockTask, createMockSession, createMockRequest, createMockSuccessResponse, createMockErrorResponse, generateMockArray, } from './utils/index.js';
17
+ export { INVALID_PARAMS, VALID_PARAMS, } from './utils/mock-factories.js';
18
+ // Fixtures
19
+ export { MOCK_USERS, MOCK_TASKS, MOCK_SESSIONS, MOCK_CONFIGS, MOCK_ADDRESSES, MOCK_ERRORS, MOCK_STREAM_CHUNKS, TEST_METHOD_SIMPLE, TEST_METHOD_COMPLEX, TEST_METHOD_VALIDATION, TEST_METHODS, getTestMethod, createTestMethod, } from './fixtures/index.js';
20
+ // Re-export invalid/valid params from fixtures
21
+ export { INVALID_PARAMS as FIXTURE_INVALID_PARAMS } from './fixtures/mock-data.js';
22
+ export { VALID_PARAMS as FIXTURE_VALID_PARAMS } from './fixtures/mock-data.js';
23
+ // Example tool (for reference/templates)
24
+ export * from './example-tool.tool.js';
25
+ export * from './methods/example.methods.js';
@@ -0,0 +1,9 @@
1
+ import { oMethod } from '@olane/o-protocol';
2
+ /**
3
+ * Method definitions for the Example Tool
4
+ * These methods are discoverable by AI agents and define the tool's capabilities
5
+ */
6
+ export declare const EXAMPLE_METHODS: {
7
+ [key: string]: oMethod;
8
+ };
9
+ //# sourceMappingURL=example.methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.methods.d.ts","sourceRoot":"","sources":["../../../src/methods/example.methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAgDrD,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Method definitions for the Example Tool
3
+ * These methods are discoverable by AI agents and define the tool's capabilities
4
+ */
5
+ export const EXAMPLE_METHODS = {
6
+ example_method: {
7
+ name: 'example_method',
8
+ description: 'Process a message and return a result. This is a simple example method demonstrating basic tool functionality.',
9
+ parameters: [
10
+ {
11
+ name: 'message',
12
+ type: 'string',
13
+ description: 'The message to process',
14
+ required: true,
15
+ },
16
+ {
17
+ name: 'metadata',
18
+ type: 'object',
19
+ description: 'Optional metadata to include with the request',
20
+ required: false,
21
+ },
22
+ ],
23
+ dependencies: [],
24
+ },
25
+ process_data: {
26
+ name: 'process_data',
27
+ description: 'Process and transform data according to specified options. Supports multiple output formats and validation.',
28
+ parameters: [
29
+ {
30
+ name: 'data',
31
+ type: 'string | object',
32
+ description: 'The data to process (can be string or object)',
33
+ required: true,
34
+ },
35
+ {
36
+ name: 'options',
37
+ type: 'object',
38
+ description: 'Processing options including format and validation settings',
39
+ required: false,
40
+ },
41
+ ],
42
+ dependencies: [],
43
+ },
44
+ get_status: {
45
+ name: 'get_status',
46
+ description: 'Get the current status of the tool including configuration and runtime information.',
47
+ parameters: [],
48
+ dependencies: [],
49
+ },
50
+ };
@@ -0,0 +1,185 @@
1
+ /**
2
+ * TestEnvironment - Core test setup and lifecycle management for O-Network nodes
3
+ *
4
+ * Provides automatic cleanup, node factories, and common test utilities
5
+ * to eliminate boilerplate in O-Network package tests.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * describe('MyTool', () => {
10
+ * const env = new TestEnvironment();
11
+ *
12
+ * afterEach(async () => {
13
+ * await env.cleanup();
14
+ * });
15
+ *
16
+ * it('should work', async () => {
17
+ * const { leader, tool } = await env.createToolWithLeader(MyTool);
18
+ * expect(tool.state).to.equal(NodeState.RUNNING);
19
+ * });
20
+ * });
21
+ * ```
22
+ */
23
+ import type { oNode, oNodeAddress } from '@olane/o-node';
24
+ /**
25
+ * Node configuration for test environment
26
+ */
27
+ export interface TestNodeConfig {
28
+ address?: oNodeAddress;
29
+ leader?: oNodeAddress | null;
30
+ parent?: oNodeAddress | null;
31
+ description?: string;
32
+ [key: string]: any;
33
+ }
34
+ /**
35
+ * Options for creating leader nodes
36
+ */
37
+ export interface LeaderNodeOptions {
38
+ address?: oNodeAddress;
39
+ description?: string;
40
+ autoStart?: boolean;
41
+ }
42
+ /**
43
+ * Result of creating a tool with leader
44
+ */
45
+ export interface ToolWithLeaderResult<T = any> {
46
+ leader: any;
47
+ tool: T;
48
+ }
49
+ /**
50
+ * Core test environment class for O-Network testing
51
+ *
52
+ * Manages node lifecycle, automatic cleanup, and provides
53
+ * factory methods for common test scenarios.
54
+ */
55
+ export declare class TestEnvironment {
56
+ private nodes;
57
+ private cleanupCallbacks;
58
+ /**
59
+ * Create a leader node for testing
60
+ *
61
+ * @param LeaderClass - Leader node class (e.g., oLeaderNode)
62
+ * @param options - Configuration options
63
+ * @returns Started leader node instance
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * const leader = await env.createLeader(oLeaderNode);
68
+ * ```
69
+ */
70
+ createLeader<T extends oNode>(LeaderClass: new (config: any) => T, options?: LeaderNodeOptions): Promise<T>;
71
+ /**
72
+ * Create a tool with a leader node
73
+ *
74
+ * Automatically handles:
75
+ * - Leader creation and startup
76
+ * - Tool creation with parent/leader references
77
+ * - Hook injection for child registration
78
+ * - Lifecycle tracking for cleanup
79
+ *
80
+ * @param ToolClass - Tool class to instantiate
81
+ * @param config - Tool configuration
82
+ * @param LeaderClass - Leader class (defaults to oLeaderNode if available)
83
+ * @returns Object with leader and tool instances
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * const { leader, tool } = await env.createToolWithLeader(MyTool, {
88
+ * apiKey: 'test-key'
89
+ * });
90
+ * ```
91
+ */
92
+ createToolWithLeader<T extends oNode>(ToolClass: new (config: any) => T, config?: TestNodeConfig, LeaderClass?: new (config: any) => any): Promise<ToolWithLeaderResult<T>>;
93
+ /**
94
+ * Create a simple node without leader
95
+ *
96
+ * @param NodeClass - Node class to instantiate
97
+ * @param config - Node configuration
98
+ * @param autoStart - Whether to start node automatically (default: true)
99
+ * @returns Node instance
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * const node = await env.createNode(MyTool, {
104
+ * address: new oNodeAddress('o://test')
105
+ * });
106
+ * ```
107
+ */
108
+ createNode<T extends oNode>(NodeClass: new (config: any) => T, config?: TestNodeConfig, autoStart?: boolean): Promise<T>;
109
+ /**
110
+ * Track a node for automatic cleanup
111
+ *
112
+ * @param node - Node instance to track
113
+ *
114
+ * @example
115
+ * ```typescript
116
+ * const node = new MyNode({});
117
+ * env.track(node);
118
+ * await node.start();
119
+ * ```
120
+ */
121
+ track(node: oNode): void;
122
+ /**
123
+ * Register a cleanup callback
124
+ *
125
+ * Useful for cleaning up external resources (databases, files, etc.)
126
+ *
127
+ * @param callback - Async cleanup function
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * const db = await createTestDB();
132
+ * env.onCleanup(async () => {
133
+ * await db.close();
134
+ * });
135
+ * ```
136
+ */
137
+ onCleanup(callback: () => Promise<void>): void;
138
+ /**
139
+ * Stop all tracked nodes and execute cleanup callbacks
140
+ *
141
+ * Stops nodes in reverse order (children before parents)
142
+ * Call this in afterEach hooks.
143
+ *
144
+ * @example
145
+ * ```typescript
146
+ * afterEach(async () => {
147
+ * await env.cleanup();
148
+ * });
149
+ * ```
150
+ */
151
+ cleanup(): Promise<void>;
152
+ /**
153
+ * Get all tracked nodes
154
+ *
155
+ * @returns Array of tracked node instances
156
+ */
157
+ getNodes(): oNode[];
158
+ /**
159
+ * Get count of tracked nodes
160
+ *
161
+ * @returns Number of tracked nodes
162
+ */
163
+ getNodeCount(): number;
164
+ /**
165
+ * Check if all tracked nodes are stopped
166
+ *
167
+ * @returns True if all nodes are stopped
168
+ */
169
+ allNodesStopped(): boolean;
170
+ /**
171
+ * Wait for a condition to be true
172
+ *
173
+ * @param condition - Function that returns true when condition is met
174
+ * @param timeoutMs - Maximum time to wait in milliseconds (default: 5000)
175
+ * @param intervalMs - Check interval in milliseconds (default: 100)
176
+ * @returns Promise that resolves when condition is met or rejects on timeout
177
+ *
178
+ * @example
179
+ * ```typescript
180
+ * await env.waitFor(() => tool.isReady, 10000);
181
+ * ```
182
+ */
183
+ waitFor(condition: () => boolean, timeoutMs?: number, intervalMs?: number): Promise<void>;
184
+ }
185
+ //# sourceMappingURL=test-environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-environment.d.ts","sourceRoot":"","sources":["../../src/test-environment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,GAAG;IAC3C,MAAM,EAAE,GAAG,CAAC;IACZ,IAAI,EAAE,CAAC,CAAC;CACT;AAED;;;;;GAKG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,gBAAgB,CAAkC;IAE1D;;;;;;;;;;;OAWG;IACG,YAAY,CAAC,CAAC,SAAS,KAAK,EAChC,WAAW,EAAE,KAAK,MAAM,EAAE,GAAG,KAAK,CAAC,EACnC,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,CAAC,CAAC;IAkBb;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,oBAAoB,CAAC,CAAC,SAAS,KAAK,EACxC,SAAS,EAAE,KAAK,MAAM,EAAE,GAAG,KAAK,CAAC,EACjC,MAAM,GAAE,cAAmB,EAC3B,WAAW,CAAC,EAAE,KAAK,MAAM,EAAE,GAAG,KAAK,GAAG,GACrC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAwCnC;;;;;;;;;;;;;;OAcG;IACG,UAAU,CAAC,CAAC,SAAS,KAAK,EAC9B,SAAS,EAAE,KAAK,MAAM,EAAE,GAAG,KAAK,CAAC,EACjC,MAAM,GAAE,cAAmB,EAC3B,SAAS,GAAE,OAAc,GACxB,OAAO,CAAC,CAAC,CAAC;IAgBb;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI;IAIxB;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAI9C;;;;;;;;;;;;OAYG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA4B9B;;;;OAIG;IACH,QAAQ,IAAI,KAAK,EAAE;IAInB;;;;OAIG;IACH,YAAY,IAAI,MAAM;IAItB;;;;OAIG;IACH,eAAe,IAAI,OAAO;IAI1B;;;;;;;;;;;;OAYG;IACG,OAAO,CACX,SAAS,EAAE,MAAM,OAAO,EACxB,SAAS,GAAE,MAAa,EACxB,UAAU,GAAE,MAAY,GACvB,OAAO,CAAC,IAAI,CAAC;CAUjB"}