Skip to content

test(news,scanner,wsh): builders + body-verifying test migration#501

Merged
wboayue merged 3 commits into
mainfrom
test/news-scanner-wsh-builders
May 3, 2026
Merged

test(news,scanner,wsh): builders + body-verifying test migration#501
wboayue merged 3 commits into
mainfrom
test/news-scanner-wsh-builders

Conversation

@wboayue
Copy link
Copy Markdown
Owner

@wboayue wboayue commented May 3, 2026

Summary

PR 6 of the test-builder rollout (see todos/test-builders.md).

  • Add request builders in src/testdata/builders/{news,scanner,wsh}.rs. contract_news / broad_tape_news reuse MarketDataRequestBuilder since they fan out through encode_request_market_data.
  • Migrate sync/async tests to assert_request<B>(builder) body verification. Move inline mod tests blocks to flat sibling _tests.rs files (news/{sync,async}_tests.rs, scanner/{sync,async}_tests.rs, wsh/{sync,async}_tests.rs, wsh/common_tests.rs).
  • Drop self-loop encoder tests in {news,scanner,wsh}/common/encoders.rs and the inline wsh::common_tests encoder asserts.
  • Remove dead MessageBus::request_messages and AsyncMessageBus::request_messages trait methods (and their MessageBusStub impls). The only consumers were the migrated sync tests, which now use the inherent MessageBusStub::request_messages via assert_request<B>(&message_bus, …).

Test plan

  • cargo fmt
  • cargo clippy --all-targets -- -D warnings
  • cargo clippy --all-targets --features sync -- -D warnings
  • cargo clippy --all-features
  • cargo test --features sync --lib — 1088 passed
  • cargo test --features async --lib — 901 passed
  • cargo test --all-features --lib — 1089 passed

wboayue added 3 commits May 3, 2026 14:41
PR 6 of the test-builder rollout.

- Add request builders in src/testdata/builders/{news,scanner,wsh}.rs;
  contract_news/broad_tape_news reuse MarketDataRequestBuilder.
- Migrate sync/async tests to assert_request<B>(builder); move inline
  mod tests blocks to sibling _tests.rs files.
- Drop self-loop encoder tests in {news,scanner,wsh}/common/encoders.rs
  and the inline wsh/mod.rs::common_tests encoder asserts.
- Remove dead MessageBus/AsyncMessageBus::request_messages trait
  methods (only consumers were the migrated sync tests, which now
  call MessageBusStub::request_messages directly).
- Rename cancel_by_request_id_builder! to single_req_id_request_builder!.
  The macro is reused for non-cancel single-req_id requests
  (WshMetaDataRequest), mirroring production's encode_cancel_by_id!.
- HistoricalNewsRequestBuilder::default contract_id is now TEST_CONTRACT_ID
  (was 0, encoded as Some(0) in tests that forget to override).
- Drop dead _silence helper + unused request_message_count import in
  wsh/sync_tests.rs.
- Drop redundant path attribute in wsh/mod.rs common_tests declaration.
- Replace magic 8314 contract id with TEST_CONTRACT_ID; lets the
  builder use its default and drops a redundant .contract_id() setter.
- Extract repeated 84|9000|... news article response literal to a
  file-local NEWS_ARTICLE_RESPONSE const (5 callsites).
@wboayue wboayue merged commit e9fc6d4 into main May 3, 2026
3 checks passed
@wboayue wboayue deleted the test/news-scanner-wsh-builders branch May 3, 2026 22:01
wboayue added a commit that referenced this pull request May 3, 2026
- test-builders.md: PRs #495-#501 merged.
- issue-441-order-status-option-doubles.md: issue closed; OrderStatus
  fields are now Option<f64>.
- issue-434-stream-decoder-error-handling.md: issue closed; main fixed
  via #490 (v2-stable mirror is a separate concern if it surfaces).
- improve-encoder-test-coverage.md: approach superseded by the
  test-builders pattern (assert_request<B>(builder) at the integration
  layer in place of field-level encoder unit tests).

Merged commits preserve the history.
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.

1 participant