Skip to content

tests: add unit tests for CloudflareImageProvider#3051

Merged
Salazareo merged 1 commit into
mainfrom
DS/2985
May 9, 2026
Merged

tests: add unit tests for CloudflareImageProvider#3051
Salazareo merged 1 commit into
mainfrom
DS/2985

Conversation

@Salazareo
Copy link
Copy Markdown
Member

Boots a real PuterServer for the wired MeteringService, stubs global fetch (the provider talks to the Cloudflare REST API directly with no SDK). Covers construction, model catalog, test_mode bypass, prompt validation, the credit gate (402 before fetch), request shape (JSON body, account-scoped /ai/run/ endpoint, apiBaseUrl override, multipart routing for requiresMultipart models, steps clamping [1,50]), output extraction (binary image/* → base64 data URL, JSON envelope image with output_format → MIME, http(s) URL passthrough, success:false 400, non-2xx 400, missing image 400), and per-scheme cost components (tile-plus-step and flux2-klein-9b-mp split).

closes #2985

Boots a real PuterServer for the wired MeteringService, stubs global
fetch (the provider talks to the Cloudflare REST API directly with no
SDK). Covers construction, model catalog, test_mode bypass, prompt
validation, the credit gate (402 before fetch), request shape (JSON
body, account-scoped /ai/run/<model> endpoint, apiBaseUrl override,
multipart routing for requiresMultipart models, steps clamping
[1,50]), output extraction (binary image/* → base64 data URL, JSON
envelope image with output_format → MIME, http(s) URL passthrough,
success:false 400, non-2xx 400, missing image 400), and per-scheme
cost components (tile-plus-step and flux2-klein-9b-mp split).

closes #2985
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 9, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 42.16%
⬇️ -0.17%
7453 / 17674
🔵 Statements 41.25%
⬇️ -0.15%
7859 / 19051
🔵 Functions 45.51%
⬇️ -0.37%
1359 / 2986
🔵 Branches 31.33%
⬇️ -0.02%
4399 / 14040
File CoverageNo changed files found.
Generated in workflow #112 for commit 9cd12bc by the Vitest Coverage Report Action

@Salazareo Salazareo merged commit 3dc9d52 into main May 9, 2026
4 checks passed
@Salazareo Salazareo deleted the DS/2985 branch May 10, 2026 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Tests] Add unit tests for CloudflareImageProvider

1 participant