@forwardimpact/libharness 0.1.11 → 0.1.14

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 ADDED
@@ -0,0 +1,10 @@
1
+ # libharness
2
+
3
+ Shared test harness and mock infrastructure.
4
+
5
+ ## Getting Started
6
+
7
+ ```js
8
+ import { createFixture } from '@forwardimpact/libharness/fixture';
9
+ import { createMock } from '@forwardimpact/libharness/mock';
10
+ ```
package/package.json CHANGED
@@ -1,18 +1,16 @@
1
1
  {
2
2
  "name": "@forwardimpact/libharness",
3
- "version": "0.1.11",
4
- "description": "Test harness and mock infrastructure for guide tests",
3
+ "version": "0.1.14",
4
+ "description": "Shared test harness and mock infrastructure for the Forward Impact monorepo",
5
5
  "type": "module",
6
- "main": "index.js",
6
+ "main": "./src/index.js",
7
7
  "exports": {
8
- ".": "./index.js",
9
- "./mock": "./mock/index.js",
10
- "./fixture": "./fixture/index.js"
8
+ ".": "./src/index.js",
9
+ "./mock": "./src/mock/index.js",
10
+ "./fixture": "./src/fixture/index.js"
11
11
  },
12
12
  "files": [
13
- "index.js",
14
- "mock/**/*.js",
15
- "fixture/**/*.js",
13
+ "src/**/*.js",
16
14
  "README.md"
17
15
  ],
18
16
  "scripts": {
@@ -9,6 +9,7 @@ import assert from "node:assert";
9
9
  export function assertThrowsMessage(fn, pattern, message) {
10
10
  assert.throws(
11
11
  fn,
12
+ // eslint-disable-next-line security/detect-non-literal-regexp -- test-only utility; pattern is developer-controlled
12
13
  { message: pattern instanceof RegExp ? pattern : new RegExp(pattern) },
13
14
  message,
14
15
  );
@@ -23,6 +24,7 @@ export function assertThrowsMessage(fn, pattern, message) {
23
24
  export async function assertRejectsMessage(fn, pattern, message) {
24
25
  await assert.rejects(
25
26
  fn,
27
+ // eslint-disable-next-line security/detect-non-literal-regexp -- test-only utility; pattern is developer-controlled
26
28
  { message: pattern instanceof RegExp ? pattern : new RegExp(pattern) },
27
29
  message,
28
30
  );
@@ -34,31 +34,16 @@ export function createMockResourceIndex(options = {}) {
34
34
  /**
35
35
  * Sets up default test resources
36
36
  * @param {object} setupOptions - Setup options
37
- * @param {string[]} [setupOptions.tools] - Tool names for agent
37
+ * @param {string[]} [setupOptions.tools] - Tool names to seed
38
38
  * @param {string} [setupOptions.conversationId] - Conversation ID
39
- * @param {string} [setupOptions.agentId] - Agent ID
40
39
  */
41
40
  setupDefaults(setupOptions = {}) {
42
- const {
43
- tools = [],
44
- conversationId = "test-conversation",
45
- agentId = "test-agent",
46
- } = setupOptions;
41
+ const { tools = [], conversationId = "test-conversation" } = setupOptions;
47
42
 
48
43
  resources.set(
49
44
  conversationId,
50
45
  common.Conversation.fromObject({
51
46
  id: { name: conversationId },
52
- agent_id: `common.Agent.${agentId}`,
53
- }),
54
- );
55
-
56
- resources.set(
57
- `common.Agent.${agentId}`,
58
- common.Agent.fromObject({
59
- id: { name: agentId, tokens: 50 },
60
- tools,
61
- content: "You are a test agent.",
62
47
  }),
63
48
  );
64
49
 
@@ -102,7 +87,7 @@ export function createMockResourceIndex(options = {}) {
102
87
  },
103
88
  };
104
89
 
105
- if (options.tools || options.conversationId || options.agentId) {
90
+ if (options.tools || options.conversationId) {
106
91
  index.setupDefaults(options);
107
92
  }
108
93
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes