@forwardimpact/libmock 0.1.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/LICENSE +201 -0
- package/README.md +122 -0
- package/package.json +44 -0
- package/src/fixture/assertions.js +42 -0
- package/src/fixture/cache.js +50 -0
- package/src/fixture/eval.js +146 -0
- package/src/fixture/index.js +9 -0
- package/src/fixture/pathway.js +451 -0
- package/src/fixture/services.js +56 -0
- package/src/index.js +3 -0
- package/src/mock/clients.js +264 -0
- package/src/mock/clock.js +62 -0
- package/src/mock/config.js +45 -0
- package/src/mock/data.js +46 -0
- package/src/mock/environments.js +80 -0
- package/src/mock/finder.js +83 -0
- package/src/mock/fs.js +301 -0
- package/src/mock/gh-client.js +28 -0
- package/src/mock/git-client.js +56 -0
- package/src/mock/grpc.js +94 -0
- package/src/mock/http.js +60 -0
- package/src/mock/index.js +49 -0
- package/src/mock/infra.js +297 -0
- package/src/mock/logger.js +42 -0
- package/src/mock/observer.js +78 -0
- package/src/mock/resource-index.js +95 -0
- package/src/mock/service-callbacks.js +39 -0
- package/src/mock/services.js +79 -0
- package/src/mock/spy.js +44 -0
- package/src/mock/storage.js +118 -0
- package/src/mock/subprocess.js +92 -0
- package/src/runtime.js +29 -0
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pathway test fixtures for creating realistic test data
|
|
3
|
+
* Provides mock disciplines, levels, tracks, skills, and behaviours
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates a mock level definition
|
|
8
|
+
* @param {object} overrides - Properties to override
|
|
9
|
+
* @returns {object} Mock level
|
|
10
|
+
*/
|
|
11
|
+
export function createTestLevel(overrides = {}) {
|
|
12
|
+
return {
|
|
13
|
+
id: "mid",
|
|
14
|
+
name: "Mid-Level",
|
|
15
|
+
ordinalRank: 3,
|
|
16
|
+
professionalTitle: "Level III",
|
|
17
|
+
managementTitle: "Manager",
|
|
18
|
+
baseSkillProficiencies: {
|
|
19
|
+
core: "working",
|
|
20
|
+
supporting: "foundational",
|
|
21
|
+
broad: "awareness",
|
|
22
|
+
},
|
|
23
|
+
baseBehaviourMaturity: "developing",
|
|
24
|
+
expectations: {},
|
|
25
|
+
...overrides,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Creates a set of mock levels spanning junior to senior
|
|
31
|
+
* @returns {object[]} Array of mock levels
|
|
32
|
+
*/
|
|
33
|
+
export function createTestLevels() {
|
|
34
|
+
return [
|
|
35
|
+
createTestLevel({
|
|
36
|
+
id: "junior",
|
|
37
|
+
name: "Junior",
|
|
38
|
+
ordinalRank: 1,
|
|
39
|
+
professionalTitle: "Level I",
|
|
40
|
+
managementTitle: "Team Lead",
|
|
41
|
+
baseSkillProficiencies: {
|
|
42
|
+
core: "foundational",
|
|
43
|
+
supporting: "awareness",
|
|
44
|
+
broad: "awareness",
|
|
45
|
+
},
|
|
46
|
+
baseBehaviourMaturity: "emerging",
|
|
47
|
+
}),
|
|
48
|
+
createTestLevel({
|
|
49
|
+
id: "mid",
|
|
50
|
+
name: "Mid-Level",
|
|
51
|
+
ordinalRank: 3,
|
|
52
|
+
professionalTitle: "Level III",
|
|
53
|
+
managementTitle: "Manager",
|
|
54
|
+
baseSkillProficiencies: {
|
|
55
|
+
core: "working",
|
|
56
|
+
supporting: "foundational",
|
|
57
|
+
broad: "awareness",
|
|
58
|
+
},
|
|
59
|
+
baseBehaviourMaturity: "developing",
|
|
60
|
+
}),
|
|
61
|
+
createTestLevel({
|
|
62
|
+
id: "senior",
|
|
63
|
+
name: "Senior",
|
|
64
|
+
ordinalRank: 5,
|
|
65
|
+
professionalTitle: "Senior",
|
|
66
|
+
managementTitle: "Senior Manager",
|
|
67
|
+
baseSkillProficiencies: {
|
|
68
|
+
core: "practitioner",
|
|
69
|
+
supporting: "working",
|
|
70
|
+
broad: "foundational",
|
|
71
|
+
},
|
|
72
|
+
baseBehaviourMaturity: "practicing",
|
|
73
|
+
}),
|
|
74
|
+
createTestLevel({
|
|
75
|
+
id: "staff",
|
|
76
|
+
name: "Staff",
|
|
77
|
+
ordinalRank: 7,
|
|
78
|
+
professionalTitle: "Staff",
|
|
79
|
+
managementTitle: "Director",
|
|
80
|
+
baseSkillProficiencies: {
|
|
81
|
+
core: "expert",
|
|
82
|
+
supporting: "practitioner",
|
|
83
|
+
broad: "working",
|
|
84
|
+
},
|
|
85
|
+
baseBehaviourMaturity: "role_modeling",
|
|
86
|
+
}),
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Creates a mock skill definition
|
|
92
|
+
* @param {object} overrides - Properties to override
|
|
93
|
+
* @returns {object} Mock skill
|
|
94
|
+
*/
|
|
95
|
+
export function createTestSkill(overrides = {}) {
|
|
96
|
+
return {
|
|
97
|
+
id: "test_skill",
|
|
98
|
+
name: "Test Skill",
|
|
99
|
+
capability: "delivery",
|
|
100
|
+
isHumanOnly: false,
|
|
101
|
+
proficiencyDescriptions: {
|
|
102
|
+
awareness: "Basic awareness",
|
|
103
|
+
foundational: "Foundational understanding",
|
|
104
|
+
working: "Working proficiency",
|
|
105
|
+
practitioner: "Practitioner level",
|
|
106
|
+
expert: "Expert level",
|
|
107
|
+
},
|
|
108
|
+
...overrides,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Creates a set of mock skills across capabilities
|
|
114
|
+
* @returns {object[]} Array of mock skills
|
|
115
|
+
*/
|
|
116
|
+
export function createTestSkills() {
|
|
117
|
+
return [
|
|
118
|
+
createTestSkill({
|
|
119
|
+
id: "coding",
|
|
120
|
+
name: "Coding",
|
|
121
|
+
capability: "delivery",
|
|
122
|
+
}),
|
|
123
|
+
createTestSkill({
|
|
124
|
+
id: "testing",
|
|
125
|
+
name: "Testing",
|
|
126
|
+
capability: "delivery",
|
|
127
|
+
}),
|
|
128
|
+
createTestSkill({
|
|
129
|
+
id: "architecture",
|
|
130
|
+
name: "Architecture",
|
|
131
|
+
capability: "scale",
|
|
132
|
+
}),
|
|
133
|
+
createTestSkill({
|
|
134
|
+
id: "observability",
|
|
135
|
+
name: "Observability",
|
|
136
|
+
capability: "scale",
|
|
137
|
+
}),
|
|
138
|
+
createTestSkill({
|
|
139
|
+
id: "ai_tools",
|
|
140
|
+
name: "AI Tools",
|
|
141
|
+
capability: "ai",
|
|
142
|
+
}),
|
|
143
|
+
createTestSkill({
|
|
144
|
+
id: "mentoring",
|
|
145
|
+
name: "Mentoring",
|
|
146
|
+
capability: "delivery",
|
|
147
|
+
isHumanOnly: true,
|
|
148
|
+
}),
|
|
149
|
+
];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Creates a mock discipline definition
|
|
154
|
+
* @param {object} overrides - Properties to override
|
|
155
|
+
* @returns {object} Mock discipline
|
|
156
|
+
*/
|
|
157
|
+
export function createTestDiscipline(overrides = {}) {
|
|
158
|
+
return {
|
|
159
|
+
id: "software_engineering",
|
|
160
|
+
name: "Software Engineering",
|
|
161
|
+
roleTitle: "Software Engineer",
|
|
162
|
+
isProfessional: true,
|
|
163
|
+
isManagement: false,
|
|
164
|
+
coreSkills: ["coding", "testing"],
|
|
165
|
+
supportingSkills: ["architecture"],
|
|
166
|
+
broadSkills: ["observability"],
|
|
167
|
+
behaviourModifiers: {},
|
|
168
|
+
validTracks: [],
|
|
169
|
+
...overrides,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Creates a mock track definition
|
|
175
|
+
* @param {object} overrides - Properties to override
|
|
176
|
+
* @returns {object} Mock track
|
|
177
|
+
*/
|
|
178
|
+
export function createTestTrack(overrides = {}) {
|
|
179
|
+
return {
|
|
180
|
+
id: "platform",
|
|
181
|
+
name: "Platform",
|
|
182
|
+
skillModifiers: { scale: 1, delivery: -1 },
|
|
183
|
+
behaviourModifiers: {},
|
|
184
|
+
...overrides,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Creates a mock behaviour definition
|
|
190
|
+
* @param {object} overrides - Properties to override
|
|
191
|
+
* @returns {object} Mock behaviour
|
|
192
|
+
*/
|
|
193
|
+
export function createTestBehaviour(overrides = {}) {
|
|
194
|
+
return {
|
|
195
|
+
id: "collaboration",
|
|
196
|
+
name: "Collaboration",
|
|
197
|
+
maturityDescriptions: {
|
|
198
|
+
emerging: "Beginning to collaborate",
|
|
199
|
+
developing: "Developing collaboration",
|
|
200
|
+
practicing: "Practicing collaboration",
|
|
201
|
+
role_modeling: "Role modeling collaboration",
|
|
202
|
+
exemplifying: "Exemplifying collaboration",
|
|
203
|
+
},
|
|
204
|
+
...overrides,
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Creates a set of mock behaviours
|
|
210
|
+
* @returns {object[]} Array of mock behaviours
|
|
211
|
+
*/
|
|
212
|
+
export function createTestBehaviours() {
|
|
213
|
+
return [
|
|
214
|
+
createTestBehaviour({ id: "collaboration", name: "Collaboration" }),
|
|
215
|
+
createTestBehaviour({ id: "communication", name: "Communication" }),
|
|
216
|
+
createTestBehaviour({ id: "leadership", name: "Leadership" }),
|
|
217
|
+
];
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Creates a mock capability definition
|
|
222
|
+
* @param {object} overrides - Properties to override
|
|
223
|
+
* @returns {object} Mock capability
|
|
224
|
+
*/
|
|
225
|
+
export function createTestCapability(overrides = {}) {
|
|
226
|
+
return {
|
|
227
|
+
id: "delivery",
|
|
228
|
+
name: "Delivery",
|
|
229
|
+
emojiIcon: "🚀",
|
|
230
|
+
ordinalRank: 1,
|
|
231
|
+
professionalResponsibilities: {
|
|
232
|
+
foundational: "Delivers assigned tasks",
|
|
233
|
+
working: "Delivers features independently",
|
|
234
|
+
practitioner: "Leads delivery across team",
|
|
235
|
+
expert: "Defines delivery strategy",
|
|
236
|
+
},
|
|
237
|
+
managementResponsibilities: {
|
|
238
|
+
foundational: "Manages delivery timelines",
|
|
239
|
+
working: "Owns team delivery",
|
|
240
|
+
practitioner: "Leads multi-team delivery",
|
|
241
|
+
expert: "Shapes delivery culture",
|
|
242
|
+
},
|
|
243
|
+
...overrides,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Creates a mock driver definition
|
|
249
|
+
* @param {object} overrides - Properties to override
|
|
250
|
+
* @returns {object} Mock driver
|
|
251
|
+
*/
|
|
252
|
+
export function createTestDriver(overrides = {}) {
|
|
253
|
+
return {
|
|
254
|
+
id: "velocity",
|
|
255
|
+
name: "Velocity",
|
|
256
|
+
contributingSkills: ["coding", "testing"],
|
|
257
|
+
contributingBehaviours: ["collaboration"],
|
|
258
|
+
...overrides,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Creates a mock skill matrix entry
|
|
264
|
+
* @param {object} overrides - Properties to override
|
|
265
|
+
* @returns {object} Mock skill matrix entry
|
|
266
|
+
*/
|
|
267
|
+
export function createTestSkillEntry(overrides = {}) {
|
|
268
|
+
return {
|
|
269
|
+
skillId: "coding",
|
|
270
|
+
skillName: "Coding",
|
|
271
|
+
capability: "delivery",
|
|
272
|
+
isHumanOnly: false,
|
|
273
|
+
type: "core",
|
|
274
|
+
proficiency: "working",
|
|
275
|
+
proficiencyDescription: "Working proficiency",
|
|
276
|
+
...overrides,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Creates a mock behaviour profile entry
|
|
282
|
+
* @param {object} overrides - Properties to override
|
|
283
|
+
* @returns {object} Mock behaviour profile entry
|
|
284
|
+
*/
|
|
285
|
+
export function createTestBehaviourEntry(overrides = {}) {
|
|
286
|
+
return {
|
|
287
|
+
behaviourId: "collaboration",
|
|
288
|
+
behaviourName: "Collaboration",
|
|
289
|
+
maturity: "developing",
|
|
290
|
+
maturityDescription: "Developing collaboration",
|
|
291
|
+
...overrides,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Creates a set of mock drivers
|
|
297
|
+
* @returns {object[]}
|
|
298
|
+
*/
|
|
299
|
+
export function createTestDrivers() {
|
|
300
|
+
return [
|
|
301
|
+
createTestDriver({
|
|
302
|
+
id: "velocity",
|
|
303
|
+
name: "Velocity",
|
|
304
|
+
contributingSkills: ["coding", "testing"],
|
|
305
|
+
contributingBehaviours: ["collaboration"],
|
|
306
|
+
}),
|
|
307
|
+
createTestDriver({
|
|
308
|
+
id: "quality",
|
|
309
|
+
name: "Quality",
|
|
310
|
+
contributingSkills: ["testing", "architecture"],
|
|
311
|
+
contributingBehaviours: ["communication"],
|
|
312
|
+
}),
|
|
313
|
+
];
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Creates a set of mock capabilities spanning delivery / scale / ai.
|
|
318
|
+
* @returns {object[]}
|
|
319
|
+
*/
|
|
320
|
+
export function createTestCapabilities() {
|
|
321
|
+
return [
|
|
322
|
+
createTestCapability({ id: "delivery", name: "Delivery", ordinalRank: 1 }),
|
|
323
|
+
createTestCapability({ id: "scale", name: "Scale", ordinalRank: 2 }),
|
|
324
|
+
createTestCapability({ id: "ai", name: "AI", ordinalRank: 3 }),
|
|
325
|
+
];
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Creates a set of mock tracks.
|
|
330
|
+
* @returns {object[]}
|
|
331
|
+
*/
|
|
332
|
+
export function createTestTracks() {
|
|
333
|
+
return [
|
|
334
|
+
createTestTrack({
|
|
335
|
+
id: "platform",
|
|
336
|
+
name: "Platform",
|
|
337
|
+
skillModifiers: { scale: 1, delivery: -1 },
|
|
338
|
+
}),
|
|
339
|
+
createTestTrack({
|
|
340
|
+
id: "forward_deployed",
|
|
341
|
+
name: "Forward Deployed",
|
|
342
|
+
skillModifiers: { delivery: 1, scale: -1 },
|
|
343
|
+
}),
|
|
344
|
+
];
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Creates a set of mock disciplines.
|
|
349
|
+
* @returns {object[]}
|
|
350
|
+
*/
|
|
351
|
+
export function createTestDisciplines() {
|
|
352
|
+
return [
|
|
353
|
+
createTestDiscipline({
|
|
354
|
+
id: "software_engineering",
|
|
355
|
+
name: "Software Engineering",
|
|
356
|
+
roleTitle: "Software Engineer",
|
|
357
|
+
}),
|
|
358
|
+
];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Builds a complete mock standard (capabilities, skills, disciplines, tracks,
|
|
363
|
+
* drivers, behaviours, levels) with sensible defaults. Per-slice overrides
|
|
364
|
+
* replace the default for that slice entirely.
|
|
365
|
+
*
|
|
366
|
+
* @param {object} [overrides]
|
|
367
|
+
* @param {object[]} [overrides.capabilities]
|
|
368
|
+
* @param {object[]} [overrides.skills]
|
|
369
|
+
* @param {object[]} [overrides.disciplines]
|
|
370
|
+
* @param {object[]} [overrides.tracks]
|
|
371
|
+
* @param {object[]} [overrides.drivers]
|
|
372
|
+
* @param {object[]} [overrides.behaviours]
|
|
373
|
+
* @param {object[]} [overrides.levels]
|
|
374
|
+
* @returns {object} Agent-aligned engineering standard with all slices populated.
|
|
375
|
+
*/
|
|
376
|
+
export function createTestStandard(overrides = {}) {
|
|
377
|
+
return {
|
|
378
|
+
capabilities: overrides.capabilities ?? createTestCapabilities(),
|
|
379
|
+
skills: overrides.skills ?? createTestSkills(),
|
|
380
|
+
disciplines: overrides.disciplines ?? createTestDisciplines(),
|
|
381
|
+
tracks: overrides.tracks ?? createTestTracks(),
|
|
382
|
+
drivers: overrides.drivers ?? createTestDrivers(),
|
|
383
|
+
behaviours: overrides.behaviours ?? createTestBehaviours(),
|
|
384
|
+
levels: overrides.levels ?? createTestLevels(),
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Creates a mock person (activity layer / people roster entry).
|
|
390
|
+
* @param {object} [overrides]
|
|
391
|
+
* @returns {object}
|
|
392
|
+
*/
|
|
393
|
+
export function createTestPerson(overrides = {}) {
|
|
394
|
+
return {
|
|
395
|
+
id: "p-alice",
|
|
396
|
+
name: "Alice",
|
|
397
|
+
email: "alice@example.com",
|
|
398
|
+
level: "mid",
|
|
399
|
+
discipline: "software_engineering",
|
|
400
|
+
track: "platform",
|
|
401
|
+
...overrides,
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Creates a mock roster (team snapshot).
|
|
407
|
+
* @param {object} [overrides]
|
|
408
|
+
* @returns {object}
|
|
409
|
+
*/
|
|
410
|
+
export function createTestRoster(overrides = {}) {
|
|
411
|
+
return {
|
|
412
|
+
team: "t-alpha",
|
|
413
|
+
members: [createTestPerson()],
|
|
414
|
+
...overrides,
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Creates a mock evidence row shared across map and landmark tests.
|
|
420
|
+
* @param {object} [overrides]
|
|
421
|
+
* @returns {object}
|
|
422
|
+
*/
|
|
423
|
+
export function createTestEvidenceRow(overrides = {}) {
|
|
424
|
+
return {
|
|
425
|
+
skill_id: "coding",
|
|
426
|
+
level_id: "mid",
|
|
427
|
+
matched: true,
|
|
428
|
+
artifact_id: "art-1",
|
|
429
|
+
created_at: "2026-01-01T00:00:00Z",
|
|
430
|
+
github_artifacts: [],
|
|
431
|
+
...overrides,
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Creates a mock skill augmented with per-level markers (human + agent arrays).
|
|
437
|
+
* @param {object} [overrides]
|
|
438
|
+
* @returns {object}
|
|
439
|
+
*/
|
|
440
|
+
export function createTestSkillWithMarkers(overrides = {}) {
|
|
441
|
+
return {
|
|
442
|
+
...createTestSkill(),
|
|
443
|
+
markers: {
|
|
444
|
+
foundational: { human: ["writes simple code"], agent: [] },
|
|
445
|
+
working: { human: ["owns features"], agent: ["reviews PRs"] },
|
|
446
|
+
practitioner: { human: ["mentors peers"], agent: [] },
|
|
447
|
+
expert: { human: ["shapes strategy"], agent: [] },
|
|
448
|
+
},
|
|
449
|
+
...overrides,
|
|
450
|
+
};
|
|
451
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test fixture utilities for creating dynamic test data
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Creates sample request data for testing
|
|
7
|
+
* @param {object} overrides - Properties to override
|
|
8
|
+
* @returns {object} Test request object
|
|
9
|
+
*/
|
|
10
|
+
export function createTestRequest(overrides = {}) {
|
|
11
|
+
return {
|
|
12
|
+
query: "test query",
|
|
13
|
+
userId: "test-user-123",
|
|
14
|
+
sessionId: "test-session-456",
|
|
15
|
+
...overrides,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Creates sample vector data for testing
|
|
21
|
+
* @param {number} count - Number of vectors to create
|
|
22
|
+
* @returns {Array} Array of test vectors
|
|
23
|
+
*/
|
|
24
|
+
export function createTestVectors(count = 3) {
|
|
25
|
+
return Array.from({ length: count }, (_, i) => ({
|
|
26
|
+
id: `vector-${i}`,
|
|
27
|
+
embedding: Array.from({ length: 384 }, () => Math.random()),
|
|
28
|
+
score: Math.random(),
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Creates sample message data for testing
|
|
34
|
+
* @param {number} count - Number of messages to create
|
|
35
|
+
* @returns {Array} Array of test messages
|
|
36
|
+
*/
|
|
37
|
+
export function createTestMessages(count = 3) {
|
|
38
|
+
const roles = ["system", "user", "assistant"];
|
|
39
|
+
return Array.from({ length: count }, (_, i) => ({
|
|
40
|
+
role: roles[i % 3],
|
|
41
|
+
content: `Test message ${i + 1}`,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Creates sample chunk data for testing
|
|
47
|
+
* @param {number} count - Number of chunks to create
|
|
48
|
+
* @returns {Array} Array of test chunks
|
|
49
|
+
*/
|
|
50
|
+
export function createTestChunks(count = 3) {
|
|
51
|
+
return Array.from({ length: count }, (_, i) => ({
|
|
52
|
+
id: `chunk-${i}`,
|
|
53
|
+
text: `This is test chunk ${i + 1} with sample content.`,
|
|
54
|
+
tokens: Math.floor(Math.random() * 100) + 10,
|
|
55
|
+
}));
|
|
56
|
+
}
|
package/src/index.js
ADDED