Skip to content

Refactor overlapping test coverage for streaming and creative rewrites#661

Open
ChristianPavilonis wants to merge 1 commit intomainfrom
refactor-test-coverage-457-458
Open

Refactor overlapping test coverage for streaming and creative rewrites#661
ChristianPavilonis wants to merge 1 commit intomainfrom
refactor-test-coverage-457-458

Conversation

@ChristianPavilonis
Copy link
Copy Markdown
Collaborator

Summary

  • Refactor overlapping UTF-8 boundary tests in streaming_replacer into shared helpers and consolidated coverage-focused cases.
  • Consolidate repetitive srcset and imagesrcset creative rewrite tests into shared helpers plus table-driven case matrices.
  • Keep runtime behavior unchanged while reducing duplicated test setup and preserving multibyte, emoji, spacing, relative path, and descriptor coverage.

Changes

File Change
crates/trusted-server-core/src/streaming_replacer.rs Added reusable chunk-processing test helpers and replaced overlapping UTF-8 boundary tests with consolidated case-based coverage, including explicit multibyte and emoji boundary splits.
crates/trusted-server-core/src/creative.rs Added shared srcset/imagesrcset test helpers and merged overlapping attribute rewrite tests into compact table-driven cases while keeping integration-specific tests separate.

Closes

Closes #457
Closes #458

Test plan

  • cargo test --workspace
  • cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • JS tests: cd crates/js/lib && npx vitest run
  • JS format: cd crates/js/lib && npm run format
  • Docs format: cd docs && npm run format
  • WASM build: cargo build --package trusted-server-adapter-fastly --release --target wasm32-wasip1
  • Manual testing via fastly compute serve
  • Other: Focused Rust test runs for the new consolidated test cases

Checklist

  • Changes follow CLAUDE.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses tracing macros (not println!)
  • New code has tests
  • No secrets or credentials committed

@ChristianPavilonis ChristianPavilonis requested review from aram356 and prk-Jr and removed request for aram356 April 24, 2026 23:44
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.

Consolidate overlapping srcset attribute tests in creative module Refactor UTF-8 boundary tests in streaming_replacer

1 participant