@nymbalhq/contract-tests 1.7.0 → 1.8.0

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/dist/index.js CHANGED
@@ -99,6 +99,7 @@ function healthAndDowntime(build, unreachable, label, operation) {
99
99
 
100
100
  // src/ai.ts
101
101
  var HANG_TIMEOUT_MS = 300;
102
+ var PROVIDER_MESSAGE_CAP = 200;
102
103
  var HANG_BOUND_MS = HANG_TIMEOUT_MS + 2e3;
103
104
  var STATUS_CODES = [
104
105
  ["status:400", "adapter.invalid_request"],
@@ -106,7 +107,7 @@ var STATUS_CODES = [
106
107
  ["status:403", "adapter.auth_failed"],
107
108
  ["status:429", "adapter.rate_limited"],
108
109
  ["status:500", "adapter.unavailable"],
109
- ["status:529", "adapter.unavailable"],
110
+ ["status:529", "adapter.overloaded"],
110
111
  ["html:502", "adapter.unavailable"],
111
112
  ["no-text", "adapter.unexpected_response"],
112
113
  ["not-json", "adapter.unexpected_response"]
@@ -363,7 +364,7 @@ var STREAMED = [
363
364
  var STREAM_STATUS = [
364
365
  ["status:401", "adapter.auth_failed"],
365
366
  ["status:429", "adapter.rate_limited"],
366
- ["status:529", "adapter.unavailable"]
367
+ ["status:529", "adapter.overloaded"]
367
368
  ];
368
369
  var STREAM_MODES = ["stream-break", "stream-error"];
369
370
  var words = (text) => text.split(/\s+/).filter((w) => w !== "");
@@ -619,7 +620,9 @@ function runAiContract(name, build, options = {}) {
619
620
  if (mode.startsWith("status:")) {
620
621
  const status = Number(mode.slice("status:".length));
621
622
  expect2(context["status"]).toBe(status);
622
- expect2(message).toBe(`${provider} answered ${status}`);
623
+ const said = `${provider} answered ${status}`;
624
+ expect2(message.slice(0, said.length)).toBe(said);
625
+ expect2(message.length).toBeLessThanOrEqual(`${said}: `.length + PROVIDER_MESSAGE_CAP);
623
626
  } else if (mode === "html:502") {
624
627
  expect2(context["status"]).toBe(502);
625
628
  expect2(message).toBe(`${provider} answered 502`);