@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,49 @@
1
+ /**
2
+ * SimpleNodeBuilder - Fluent API for creating single-node tests
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * const node = await new SimpleNodeBuilder(MyTool)
7
+ * .withConfig({ apiKey: 'test' })
8
+ * .withAddress('o://test-tool')
9
+ * .build(env);
10
+ * ```
11
+ */
12
+ import type { oNode, oNodeAddress } from '@olane/o-node';
13
+ import type { TestEnvironment } from '../test-environment.js';
14
+ import type { TestNodeConfig } from '../test-environment.js';
15
+ export declare class SimpleNodeBuilder<T extends oNode = any> {
16
+ private nodeClass;
17
+ private config;
18
+ private autoStart;
19
+ constructor(NodeClass: new (config: any) => T);
20
+ /**
21
+ * Set node configuration
22
+ */
23
+ withConfig(config: TestNodeConfig): this;
24
+ /**
25
+ * Set node address
26
+ */
27
+ withAddress(address: string | oNodeAddress): this;
28
+ /**
29
+ * Set node description
30
+ */
31
+ withDescription(description: string): this;
32
+ /**
33
+ * Set leader reference
34
+ */
35
+ withLeader(leader: oNodeAddress | null): this;
36
+ /**
37
+ * Set parent reference
38
+ */
39
+ withParent(parent: oNodeAddress | null): this;
40
+ /**
41
+ * Control automatic start
42
+ */
43
+ withAutoStart(autoStart: boolean): this;
44
+ /**
45
+ * Build and create the node
46
+ */
47
+ build(env: TestEnvironment): Promise<T>;
48
+ }
49
+ //# sourceMappingURL=simple-node-builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-node-builder.d.ts","sourceRoot":"","sources":["../../../src/builders/simple-node-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE7D,qBAAa,iBAAiB,CAAC,CAAC,SAAS,KAAK,GAAG,GAAG;IAClD,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,SAAS,CAAiB;gBAEtB,SAAS,EAAE,KAAK,MAAM,EAAE,GAAG,KAAK,CAAC;IAI7C;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;IAKxC;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI;IAKjD;;OAEG;IACH,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAK1C;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,GAAG,IAAI;IAK7C;;OAEG;IACH,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,GAAG,IAAI;IAK7C;;OAEG;IACH,aAAa,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;IAKvC;;OAEG;IACG,KAAK,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,CAAC,CAAC;CAG9C"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * SimpleNodeBuilder - Fluent API for creating single-node tests
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * const node = await new SimpleNodeBuilder(MyTool)
7
+ * .withConfig({ apiKey: 'test' })
8
+ * .withAddress('o://test-tool')
9
+ * .build(env);
10
+ * ```
11
+ */
12
+ export class SimpleNodeBuilder {
13
+ constructor(NodeClass) {
14
+ this.config = {};
15
+ this.autoStart = true;
16
+ this.nodeClass = NodeClass;
17
+ }
18
+ /**
19
+ * Set node configuration
20
+ */
21
+ withConfig(config) {
22
+ this.config = { ...this.config, ...config };
23
+ return this;
24
+ }
25
+ /**
26
+ * Set node address
27
+ */
28
+ withAddress(address) {
29
+ this.config.address = address;
30
+ return this;
31
+ }
32
+ /**
33
+ * Set node description
34
+ */
35
+ withDescription(description) {
36
+ this.config.description = description;
37
+ return this;
38
+ }
39
+ /**
40
+ * Set leader reference
41
+ */
42
+ withLeader(leader) {
43
+ this.config.leader = leader;
44
+ return this;
45
+ }
46
+ /**
47
+ * Set parent reference
48
+ */
49
+ withParent(parent) {
50
+ this.config.parent = parent;
51
+ return this;
52
+ }
53
+ /**
54
+ * Control automatic start
55
+ */
56
+ withAutoStart(autoStart) {
57
+ this.autoStart = autoStart;
58
+ return this;
59
+ }
60
+ /**
61
+ * Build and create the node
62
+ */
63
+ async build(env) {
64
+ return await env.createNode(this.nodeClass, this.config, this.autoStart);
65
+ }
66
+ }
@@ -0,0 +1,58 @@
1
+ import { ToolResult } from '@olane/o-tool';
2
+ import { oRequest } from '@olane/o-core';
3
+ import { oLaneTool } from '@olane/o-lane';
4
+ import { oNodeToolConfig } from '@olane/o-node';
5
+ /**
6
+ * ExampleTool - A template demonstrating oLane tool best practices
7
+ *
8
+ * This tool provides example implementations of common patterns:
9
+ * - Tool class structure and initialization
10
+ * - Method definitions and implementations
11
+ * - Error handling
12
+ * - Logging
13
+ * - Configuration management
14
+ * - Type safety with TypeScript
15
+ *
16
+ * Use this as a starting point for creating your own oLane tools.
17
+ */
18
+ export declare class ExampleTool extends oLaneTool {
19
+ /**
20
+ * Create a new ExampleTool instance
21
+ *
22
+ * @param config - Configuration options for the tool
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const tool = new ExampleTool({
27
+ * customOption: 'value',
28
+ * debugMode: true,
29
+ * timeout: 60000
30
+ * });
31
+ * await tool.start();
32
+ * ```
33
+ */
34
+ constructor(config: oNodeToolConfig);
35
+ /**
36
+ * Process a message and return a result
37
+ *
38
+ * This method demonstrates:
39
+ * - Parameter extraction and validation
40
+ * - Error handling with try/catch
41
+ * - Logging
42
+ * - Returning structured results
43
+ *
44
+ * @param request - The oRequest containing method parameters
45
+ * @returns ExampleMethodResponse with success status and result/error
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * const result = await tool.callMyTool({
50
+ * method: 'example_method',
51
+ * params: { message: 'Hello, oLane!' }
52
+ * });
53
+ * console.log(result.result); // "Processed: Hello, oLane!"
54
+ * ```
55
+ */
56
+ _tool_example_method(request: oRequest): Promise<ToolResult>;
57
+ }
58
+ //# sourceMappingURL=example-tool.tool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-tool.tool.d.ts","sourceRoot":"","sources":["../../src/example-tool.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAgB,eAAe,EAAE,MAAM,eAAe,CAAC;AAG9D;;;;;;;;;;;;GAYG;AACH,qBAAa,WAAY,SAAQ,SAAS;IACxC;;;;;;;;;;;;;;OAcG;gBACS,MAAM,EAAE,eAAe;IAUnC;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,oBAAoB,CAAC,OAAO,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CA8BnE"}
@@ -0,0 +1,89 @@
1
+ import { oLaneTool } from '@olane/o-lane';
2
+ import { oNodeAddress } from '@olane/o-node';
3
+ import { EXAMPLE_METHODS } from './methods/example.methods.js';
4
+ /**
5
+ * ExampleTool - A template demonstrating oLane tool best practices
6
+ *
7
+ * This tool provides example implementations of common patterns:
8
+ * - Tool class structure and initialization
9
+ * - Method definitions and implementations
10
+ * - Error handling
11
+ * - Logging
12
+ * - Configuration management
13
+ * - Type safety with TypeScript
14
+ *
15
+ * Use this as a starting point for creating your own oLane tools.
16
+ */
17
+ export class ExampleTool extends oLaneTool {
18
+ /**
19
+ * Create a new ExampleTool instance
20
+ *
21
+ * @param config - Configuration options for the tool
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const tool = new ExampleTool({
26
+ * customOption: 'value',
27
+ * debugMode: true,
28
+ * timeout: 60000
29
+ * });
30
+ * await tool.start();
31
+ * ```
32
+ */
33
+ constructor(config) {
34
+ super({
35
+ ...config,
36
+ address: new oNodeAddress('o://example'),
37
+ description: 'Example tool demonstrating oLane best practices for tool development',
38
+ methods: EXAMPLE_METHODS,
39
+ });
40
+ }
41
+ /**
42
+ * Process a message and return a result
43
+ *
44
+ * This method demonstrates:
45
+ * - Parameter extraction and validation
46
+ * - Error handling with try/catch
47
+ * - Logging
48
+ * - Returning structured results
49
+ *
50
+ * @param request - The oRequest containing method parameters
51
+ * @returns ExampleMethodResponse with success status and result/error
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * const result = await tool.callMyTool({
56
+ * method: 'example_method',
57
+ * params: { message: 'Hello, oLane!' }
58
+ * });
59
+ * console.log(result.result); // "Processed: Hello, oLane!"
60
+ * ```
61
+ */
62
+ async _tool_example_method(request) {
63
+ try {
64
+ const { message, metadata } = request.params;
65
+ // Validate required parameters
66
+ if (!message) {
67
+ return {
68
+ success: false,
69
+ error: 'Parameter "message" is required',
70
+ };
71
+ }
72
+ // Process the message (example implementation)
73
+ const result = `Processed: ${message}`;
74
+ this.logger.info('Successfully processed message');
75
+ return {
76
+ success: true,
77
+ result,
78
+ timestamp: Date.now(),
79
+ };
80
+ }
81
+ catch (error) {
82
+ this.logger.error('Error in example_method:', error);
83
+ return {
84
+ success: false,
85
+ error: error.message || 'Unknown error occurred',
86
+ };
87
+ }
88
+ }
89
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Type-safe fixtures for common test data
3
+ */
4
+ export * from './mock-data.js';
5
+ export * from './test-methods.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fixtures/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Type-safe fixtures for common test data
3
+ */
4
+ export * from './mock-data.js';
5
+ export * from './test-methods.js';
@@ -0,0 +1,201 @@
1
+ /**
2
+ * Mock data fixtures for testing
3
+ *
4
+ * Provides consistent test data across packages
5
+ */
6
+ /**
7
+ * Mock user data
8
+ */
9
+ export declare const MOCK_USERS: {
10
+ basic: {
11
+ userId: string;
12
+ username: string;
13
+ email: string;
14
+ role: string;
15
+ active: boolean;
16
+ };
17
+ admin: {
18
+ userId: string;
19
+ username: string;
20
+ email: string;
21
+ role: string;
22
+ active: boolean;
23
+ };
24
+ inactive: {
25
+ userId: string;
26
+ username: string;
27
+ email: string;
28
+ role: string;
29
+ active: boolean;
30
+ };
31
+ };
32
+ /**
33
+ * Mock task data
34
+ */
35
+ export declare const MOCK_TASKS: {
36
+ pending: {
37
+ taskId: string;
38
+ title: string;
39
+ description: string;
40
+ status: string;
41
+ createdAt: number;
42
+ updatedAt: number;
43
+ };
44
+ active: {
45
+ taskId: string;
46
+ title: string;
47
+ description: string;
48
+ status: string;
49
+ createdAt: number;
50
+ updatedAt: number;
51
+ };
52
+ completed: {
53
+ taskId: string;
54
+ title: string;
55
+ description: string;
56
+ status: string;
57
+ createdAt: number;
58
+ updatedAt: number;
59
+ };
60
+ };
61
+ /**
62
+ * Mock session data
63
+ */
64
+ export declare const MOCK_SESSIONS: {
65
+ valid: {
66
+ sessionId: string;
67
+ userId: string;
68
+ createdAt: number;
69
+ expiresAt: number;
70
+ active: boolean;
71
+ };
72
+ expired: {
73
+ sessionId: string;
74
+ userId: string;
75
+ createdAt: number;
76
+ expiresAt: number;
77
+ active: boolean;
78
+ };
79
+ };
80
+ /**
81
+ * Mock configuration data
82
+ */
83
+ export declare const MOCK_CONFIGS: {
84
+ simple: {
85
+ apiKey: string;
86
+ endpoint: string;
87
+ timeout: number;
88
+ };
89
+ advanced: {
90
+ apiKey: string;
91
+ endpoint: string;
92
+ timeout: number;
93
+ retries: number;
94
+ headers: {
95
+ 'Content-Type': string;
96
+ Authorization: string;
97
+ };
98
+ };
99
+ };
100
+ /**
101
+ * Mock addresses
102
+ */
103
+ export declare const MOCK_ADDRESSES: {
104
+ leader: string;
105
+ node: string;
106
+ tool: string;
107
+ service: string;
108
+ worker: string;
109
+ };
110
+ /**
111
+ * Mock error messages
112
+ */
113
+ export declare const MOCK_ERRORS: {
114
+ required: string;
115
+ notFound: string;
116
+ unauthorized: string;
117
+ invalidType: string;
118
+ timeout: string;
119
+ networkError: string;
120
+ };
121
+ /**
122
+ * Invalid parameter sets for validation testing
123
+ */
124
+ export declare const INVALID_PARAMS: {
125
+ missing: {};
126
+ nullParam: {
127
+ param: null;
128
+ };
129
+ undefinedParam: {
130
+ param: undefined;
131
+ };
132
+ emptyString: {
133
+ param: string;
134
+ };
135
+ wrongType: {
136
+ stringParam: number;
137
+ numberParam: string;
138
+ };
139
+ negativeNumber: {
140
+ count: number;
141
+ timeout: number;
142
+ };
143
+ emptyArray: {
144
+ items: never[];
145
+ };
146
+ invalidEnum: {
147
+ status: string;
148
+ };
149
+ };
150
+ /**
151
+ * Valid parameter sets for testing
152
+ */
153
+ export declare const VALID_PARAMS: {
154
+ simple: {
155
+ param1: string;
156
+ param2: string;
157
+ };
158
+ withTypes: {
159
+ stringParam: string;
160
+ numberParam: number;
161
+ booleanParam: boolean;
162
+ arrayParam: number[];
163
+ objectParam: {
164
+ key: string;
165
+ };
166
+ };
167
+ userId: {
168
+ userId: string;
169
+ };
170
+ taskId: {
171
+ taskId: string;
172
+ };
173
+ sessionId: {
174
+ sessionId: string;
175
+ };
176
+ };
177
+ /**
178
+ * Mock streaming chunks
179
+ */
180
+ export declare const MOCK_STREAM_CHUNKS: {
181
+ simple: {
182
+ index: number;
183
+ message: string;
184
+ }[];
185
+ withProgress: {
186
+ progress: number;
187
+ status: string;
188
+ }[];
189
+ withErrors: ({
190
+ index: number;
191
+ success: boolean;
192
+ data: string;
193
+ error?: undefined;
194
+ } | {
195
+ index: number;
196
+ success: boolean;
197
+ error: string;
198
+ data?: undefined;
199
+ })[];
200
+ };
201
+ //# sourceMappingURL=mock-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-data.d.ts","sourceRoot":"","sources":["../../../src/fixtures/mock-data.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;CAsBtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;CAyBtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;CAezB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;CAgBxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;CAM1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;CAOvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;CAS1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;CAqBxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;CAkB9B,CAAC"}
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Mock data fixtures for testing
3
+ *
4
+ * Provides consistent test data across packages
5
+ */
6
+ /**
7
+ * Mock user data
8
+ */
9
+ export const MOCK_USERS = {
10
+ basic: {
11
+ userId: 'user-test-001',
12
+ username: 'testuser',
13
+ email: 'test@example.com',
14
+ role: 'user',
15
+ active: true,
16
+ },
17
+ admin: {
18
+ userId: 'user-admin-001',
19
+ username: 'adminuser',
20
+ email: 'admin@example.com',
21
+ role: 'admin',
22
+ active: true,
23
+ },
24
+ inactive: {
25
+ userId: 'user-inactive-001',
26
+ username: 'inactive',
27
+ email: 'inactive@example.com',
28
+ role: 'user',
29
+ active: false,
30
+ },
31
+ };
32
+ /**
33
+ * Mock task data
34
+ */
35
+ export const MOCK_TASKS = {
36
+ pending: {
37
+ taskId: 'task-001',
38
+ title: 'Pending Task',
39
+ description: 'A task in pending state',
40
+ status: 'pending',
41
+ createdAt: Date.now() - 3600000,
42
+ updatedAt: Date.now() - 1800000,
43
+ },
44
+ active: {
45
+ taskId: 'task-002',
46
+ title: 'Active Task',
47
+ description: 'A task in active state',
48
+ status: 'active',
49
+ createdAt: Date.now() - 7200000,
50
+ updatedAt: Date.now() - 600000,
51
+ },
52
+ completed: {
53
+ taskId: 'task-003',
54
+ title: 'Completed Task',
55
+ description: 'A task in completed state',
56
+ status: 'completed',
57
+ createdAt: Date.now() - 86400000,
58
+ updatedAt: Date.now() - 3600000,
59
+ },
60
+ };
61
+ /**
62
+ * Mock session data
63
+ */
64
+ export const MOCK_SESSIONS = {
65
+ valid: {
66
+ sessionId: 'session-valid-001',
67
+ userId: 'user-test-001',
68
+ createdAt: Date.now() - 1800000,
69
+ expiresAt: Date.now() + 1800000,
70
+ active: true,
71
+ },
72
+ expired: {
73
+ sessionId: 'session-expired-001',
74
+ userId: 'user-test-002',
75
+ createdAt: Date.now() - 7200000,
76
+ expiresAt: Date.now() - 1800000,
77
+ active: false,
78
+ },
79
+ };
80
+ /**
81
+ * Mock configuration data
82
+ */
83
+ export const MOCK_CONFIGS = {
84
+ simple: {
85
+ apiKey: 'test-api-key-123',
86
+ endpoint: 'http://localhost:3000',
87
+ timeout: 5000,
88
+ },
89
+ advanced: {
90
+ apiKey: 'test-api-key-advanced',
91
+ endpoint: 'https://api.test.example.com',
92
+ timeout: 10000,
93
+ retries: 3,
94
+ headers: {
95
+ 'Content-Type': 'application/json',
96
+ 'Authorization': 'Bearer test-token',
97
+ },
98
+ },
99
+ };
100
+ /**
101
+ * Mock addresses
102
+ */
103
+ export const MOCK_ADDRESSES = {
104
+ leader: 'o://test-leader',
105
+ node: 'o://test-node',
106
+ tool: 'o://test-tool',
107
+ service: 'o://test-service',
108
+ worker: 'o://test-worker',
109
+ };
110
+ /**
111
+ * Mock error messages
112
+ */
113
+ export const MOCK_ERRORS = {
114
+ required: 'Parameter is required',
115
+ notFound: 'Resource not found',
116
+ unauthorized: 'Unauthorized access',
117
+ invalidType: 'Invalid parameter type',
118
+ timeout: 'Operation timed out',
119
+ networkError: 'Network connection failed',
120
+ };
121
+ /**
122
+ * Invalid parameter sets for validation testing
123
+ */
124
+ export const INVALID_PARAMS = {
125
+ missing: {},
126
+ nullParam: { param: null },
127
+ undefinedParam: { param: undefined },
128
+ emptyString: { param: '' },
129
+ wrongType: { stringParam: 123, numberParam: 'text' },
130
+ negativeNumber: { count: -1, timeout: -500 },
131
+ emptyArray: { items: [] },
132
+ invalidEnum: { status: 'invalid-status' },
133
+ };
134
+ /**
135
+ * Valid parameter sets for testing
136
+ */
137
+ export const VALID_PARAMS = {
138
+ simple: {
139
+ param1: 'value1',
140
+ param2: 'value2',
141
+ },
142
+ withTypes: {
143
+ stringParam: 'test',
144
+ numberParam: 42,
145
+ booleanParam: true,
146
+ arrayParam: [1, 2, 3],
147
+ objectParam: { key: 'value' },
148
+ },
149
+ userId: {
150
+ userId: MOCK_USERS.basic.userId,
151
+ },
152
+ taskId: {
153
+ taskId: MOCK_TASKS.pending.taskId,
154
+ },
155
+ sessionId: {
156
+ sessionId: MOCK_SESSIONS.valid.sessionId,
157
+ },
158
+ };
159
+ /**
160
+ * Mock streaming chunks
161
+ */
162
+ export const MOCK_STREAM_CHUNKS = {
163
+ simple: [
164
+ { index: 0, message: 'chunk 1' },
165
+ { index: 1, message: 'chunk 2' },
166
+ { index: 2, message: 'chunk 3' },
167
+ ],
168
+ withProgress: [
169
+ { progress: 0, status: 'starting' },
170
+ { progress: 25, status: 'processing' },
171
+ { progress: 50, status: 'half-done' },
172
+ { progress: 75, status: 'almost-there' },
173
+ { progress: 100, status: 'complete' },
174
+ ],
175
+ withErrors: [
176
+ { index: 0, success: true, data: 'chunk 1' },
177
+ { index: 1, success: true, data: 'chunk 2' },
178
+ { index: 2, success: false, error: 'Failed' },
179
+ ],
180
+ };
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Test method definitions for testing
3
+ *
4
+ * Provides sample oMethod definitions for testing tools
5
+ */
6
+ import type { oMethod } from '@olane/o-protocol';
7
+ /**
8
+ * Simple test method definition
9
+ */
10
+ export declare const TEST_METHOD_SIMPLE: oMethod;
11
+ /**
12
+ * Method with multiple parameters and types
13
+ */
14
+ export declare const TEST_METHOD_COMPLEX: oMethod;
15
+ /**
16
+ * Method with validation and errors
17
+ */
18
+ export declare const TEST_METHOD_VALIDATION: oMethod;
19
+ /**
20
+ * Collection of test methods
21
+ */
22
+ export declare const TEST_METHODS: {
23
+ [key: string]: oMethod;
24
+ };
25
+ /**
26
+ * Get a test method definition by name
27
+ */
28
+ export declare function getTestMethod(name: string): oMethod | undefined;
29
+ /**
30
+ * Create a custom test method
31
+ */
32
+ export declare function createTestMethod(name: string, description: string, parameters?: any[]): oMethod;
33
+ //# sourceMappingURL=test-methods.d.ts.map