Model Client.Test

loom-sprint-scaffoldtesttypescript
Path: loom-sprint-scaffold/loom/tests/execution/model-client.test.tsRelative: loom/tests/execution/model-client.test.tsSubproject: loom-sprint-scaffoldCategory: tests
Lines: 349Bytes: 10,934Imports: 3Exports: 0has tests

Content Preview

  1. /**
  2. * Tests for model-client (H3.0).
  3. *
  4. * Proves:
  5. * - createAnthropicModelCaller returns a callable ModelCaller
  6. * - wraps calls with retry (≥3 attempts on 5xx)
  7. * - fails fast on 4xx errors (ModelError.status)
  8. * - passes correct JSON body to fetch
  9. * - the returned function matches the ModelCaller interface
  10. *
  11. * CRITICAL: Tests inject a fake fetchFn — never hit the real Anthropic API.
  12. */
  13. import { describe, expect, test } from "bun:test";
  14. import { createAnthropicModelCaller } from "../../s