@frontmcp/testing 0.12.2 → 1.0.0-beta.1

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 (42) hide show
  1. package/assertions/mcp-assertions.d.ts +1 -1
  2. package/assertions/mcp-assertions.d.ts.map +1 -1
  3. package/client/mcp-test-client.builder.d.ts +1 -1
  4. package/client/mcp-test-client.d.ts.map +1 -1
  5. package/client/mcp-test-client.types.d.ts +3 -3
  6. package/client/mcp-test-client.types.d.ts.map +1 -1
  7. package/errors/index.d.ts.map +1 -1
  8. package/esm/fixtures/index.mjs +239 -36
  9. package/esm/index.mjs +267 -112
  10. package/esm/matchers/index.mjs +8 -32
  11. package/esm/package.json +5 -5
  12. package/esm/perf/index.mjs +239 -36
  13. package/esm/setup.mjs +8 -32
  14. package/example-tools/index.d.ts +1 -1
  15. package/example-tools/index.d.ts.map +1 -1
  16. package/example-tools/tool-configs.d.ts +4 -10
  17. package/example-tools/tool-configs.d.ts.map +1 -1
  18. package/fixtures/index.js +232 -36
  19. package/index.d.ts +2 -1
  20. package/index.d.ts.map +1 -1
  21. package/index.js +264 -114
  22. package/matchers/index.js +8 -32
  23. package/package.json +5 -5
  24. package/perf/index.js +232 -36
  25. package/platform/platform-client-info.d.ts +2 -1
  26. package/platform/platform-client-info.d.ts.map +1 -1
  27. package/platform/platform-types.d.ts +11 -16
  28. package/platform/platform-types.d.ts.map +1 -1
  29. package/playwright/index.d.ts +1 -1
  30. package/raw-client/index.d.ts +7 -0
  31. package/raw-client/index.d.ts.map +1 -0
  32. package/server/index.d.ts +1 -1
  33. package/server/index.d.ts.map +1 -1
  34. package/server/port-registry.d.ts +24 -6
  35. package/server/port-registry.d.ts.map +1 -1
  36. package/server/test-server.d.ts +1 -1
  37. package/server/test-server.d.ts.map +1 -1
  38. package/setup.js +8 -32
  39. package/ui/ui-assertions.d.ts +3 -4
  40. package/ui/ui-assertions.d.ts.map +1 -1
  41. package/ui/ui-matchers.d.ts +1 -2
  42. package/ui/ui-matchers.d.ts.map +1 -1
package/setup.js CHANGED
@@ -5,23 +5,13 @@ var import_globals = require("@jest/globals");
5
5
 
6
6
  // libs/testing/src/platform/platform-types.ts
7
7
  function getPlatformMimeType(platform) {
8
- return platform === "openai" ? "text/html+skybridge" : "text/html+mcp";
8
+ return "text/html;profile=mcp-app";
9
9
  }
10
10
  function getToolCallMetaPrefixes(platform) {
11
- switch (platform) {
12
- case "openai":
13
- return ["openai/"];
14
- default:
15
- return ["ui/"];
16
- }
11
+ return ["ui/"];
17
12
  }
18
13
  function getForbiddenMetaPrefixes(platform) {
19
- switch (platform) {
20
- case "openai":
21
- return ["ui/", "frontmcp/"];
22
- default:
23
- return ["openai/", "frontmcp/"];
24
- }
14
+ return ["openai/", "frontmcp/"];
25
15
  }
26
16
 
27
17
  // libs/testing/src/ui/ui-matchers.ts
@@ -128,12 +118,12 @@ var toHaveWidgetMetadata = function(received) {
128
118
  };
129
119
  }
130
120
  const hasUiHtml = Boolean(meta["ui/html"]);
131
- const hasOutputTemplate = Boolean(meta["openai/outputTemplate"]);
132
121
  const hasMimeType = Boolean(meta["ui/mimeType"]);
133
- const pass = hasUiHtml || hasOutputTemplate || hasMimeType;
122
+ const hasUiObject = Boolean(meta["ui"] && typeof meta["ui"] === "object");
123
+ const pass = hasUiHtml || hasMimeType || hasUiObject;
134
124
  return {
135
125
  pass,
136
- message: () => pass ? "Expected result not to have widget metadata" : "Expected _meta to have widget metadata (ui/html, openai/outputTemplate, or ui/mimeType)"
126
+ message: () => pass ? "Expected result not to have widget metadata" : "Expected _meta to have widget metadata (ui/html, ui/mimeType, or ui object)"
137
127
  };
138
128
  };
139
129
  var toHaveCssClass = function(received, className) {
@@ -296,14 +286,7 @@ var toHavePlatformMimeType = function(received, platform) {
296
286
  message: () => `Expected _meta to have MIME type "${expectedMimeType}" for platform "${platform}", but no _meta found`
297
287
  };
298
288
  }
299
- let mimeTypeKey;
300
- switch (platform) {
301
- case "openai":
302
- mimeTypeKey = "openai/mimeType";
303
- break;
304
- default:
305
- mimeTypeKey = "ui/mimeType";
306
- }
289
+ const mimeTypeKey = "ui/mimeType";
307
290
  const actualMimeType = meta[mimeTypeKey];
308
291
  const pass = actualMimeType === expectedMimeType;
309
292
  return {
@@ -319,14 +302,7 @@ var toHavePlatformHtml = function(received, platform) {
319
302
  message: () => `Expected _meta to have platform HTML for "${platform}", but no _meta found`
320
303
  };
321
304
  }
322
- let htmlKey;
323
- switch (platform) {
324
- case "openai":
325
- htmlKey = "openai/html";
326
- break;
327
- default:
328
- htmlKey = "ui/html";
329
- }
305
+ const htmlKey = "ui/html";
330
306
  const html = meta[htmlKey];
331
307
  const pass = typeof html === "string" && html.length > 0;
332
308
  return {
@@ -6,8 +6,7 @@
6
6
  * from @frontmcp/ui/adapters. Key fields include:
7
7
  * - `ui/html`: Inline rendered HTML (universal)
8
8
  * - `ui/mimeType`: MIME type for the HTML content
9
- * - `openai/outputTemplate`: Resource URI for widget template (OpenAI)
10
- * - `openai/widgetAccessible`: Whether widget can invoke tools (OpenAI)
9
+ * - `ui`: Nested UI object with resourceUri, csp, etc.
11
10
  *
12
11
  * @see {@link https://docs.agentfront.dev/docs/servers/tools#tool-ui | Tool UI Documentation}
13
12
  *
@@ -79,7 +78,7 @@ export declare const UIAssertions: {
79
78
  assertNotContainsRaw(html: string, content: string): void;
80
79
  /**
81
80
  * Assert that widget metadata is present in the result.
82
- * Checks for ui/html, openai/outputTemplate, or ui/mimeType.
81
+ * Checks for ui/html, ui/mimeType, or nested ui object with resourceUri.
83
82
  * @param result - The tool result wrapper
84
83
  * @throws Error if widget metadata is missing
85
84
  */
@@ -94,7 +93,7 @@ export declare const UIAssertions: {
94
93
  assertValidUI(result: ToolResultWrapper, boundKeys?: string[]): string;
95
94
  /**
96
95
  * Assert tool result has correct meta keys for OpenAI platform.
97
- * Verifies openai/* keys are present and ui/*, frontmcp/* keys are absent.
96
+ * Verifies ui/* keys are present and openai/*, frontmcp/* keys are absent.
98
97
  * @param result - The tool result wrapper
99
98
  * @throws Error if meta keys don't match OpenAI expectations
100
99
  */
@@ -1 +1 @@
1
- {"version":3,"file":"ui-assertions.d.ts","sourceRoot":"","sources":["../../src/ui/ui-assertions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAsBnE;;;GAGG;AACH,eAAO,MAAM,YAAY;IACvB;;;;;OAKG;6BACsB,iBAAiB,GAAG,MAAM;IA2BnD;;;;;;OAMG;4BACqB,MAAM,UAAU,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,MAAM,EAAE,GAAG,IAAI;IAsBtF;;;;OAIG;wBACiB,MAAM,GAAG,IAAI;IAoBjC;;;;OAIG;oCAC6B,MAAM,GAAG,IAAI;IAe7C;;;;;OAKG;gCACyB,MAAM,OAAO,MAAM,GAAG,IAAI;IAQtD;;;;;OAKG;4BACqB,MAAM,aAAa,MAAM,GAAG,IAAI;IAQxD;;;;;;OAMG;+BACwB,MAAM,WAAW,MAAM,GAAG,IAAI;IASzD;;;;;OAKG;iCAC0B,iBAAiB,GAAG,IAAI;IAiBrD;;;;;;OAMG;0BACmB,iBAAiB,cAAc,MAAM,EAAE,GAAG,MAAM;IA2BtE;;;;;OAKG;6BACsB,iBAAiB,GAAG,IAAI;IAIjD;;;;;OAKG;8BACuB,iBAAiB,GAAG,IAAI;IAIlD;;;;;OAKG;yBACkB,iBAAiB,GAAG,IAAI;IAI7C;;;;;OAKG;+BACwB,iBAAiB,YAAY,gBAAgB,GAAG,IAAI;IAgC/E;;;;;OAKG;oCAC6B,iBAAiB,qBAAqB,MAAM,GAAG,IAAI;IAkBnF;;;;;OAKG;mCAC4B,iBAAiB,YAAY,gBAAgB,GAAG,IAAI;IA6BnF;;;;;;OAMG;+BACwB,iBAAiB,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;;;;;;OAMG;+BACwB,iBAAiB,YAAY,gBAAgB,GAAG,MAAM;IAqBjF;;;;;;OAMG;oCAC6B,iBAAiB,YAAY,gBAAgB,GAAG,MAAM;CAUvF,CAAC"}
@@ -6,8 +6,7 @@
6
6
  * from @frontmcp/ui/adapters. Key fields include:
7
7
  * - `ui/html`: Inline rendered HTML (universal)
8
8
  * - `ui/mimeType`: MIME type for the HTML content
9
- * - `openai/outputTemplate`: Resource URI for widget template (OpenAI)
10
- * - `openai/widgetAccessible`: Whether widget can invoke tools (OpenAI)
9
+ * - `ui`: Nested UI object with resourceUri, csp, etc.
11
10
  *
12
11
  * @see {@link https://docs.agentfront.dev/docs/servers/tools#tool-ui | Tool UI Documentation}
13
12
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ui-matchers.d.ts","sourceRoot":"","sources":["../../src/ui/ui-matchers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAohBnE;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;CAkBtB,CAAC"}
1
+ {"version":3,"file":"ui-matchers.d.ts","sourceRoot":"","sources":["../../src/ui/ui-matchers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AA+fnE;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;CAkBtB,CAAC"}