Skip to content

Conversation

WuonParticle
Copy link
Contributor

@WuonParticle WuonParticle commented Jul 17, 2025

Before submitting this PR, please make sure:

  • Your code builds clean without any errors or warnings
  • You are using approved title ("feat/", "fix/", "docs/", "refactor/")

A description of the changes proposed in the pull request:

  • New Features

    • Introduced a comprehensive "Record and Play" (RnP) testing framework with documentation, a reusable test harness, and dependency mocking strategies.
    • Added modular Fastify API endpoints and a sample API demonstrating diverse dependency scenarios.
    • Implemented snapshot-based API test cases with mock data management ensuring deterministic unit tests.
    • Provided custom serialization support for complex data types like BigNumber in tests.
    • Added VS Code configuration guide for managing multiple Jest test suites and debugging workflows.
  • Bug Fixes

    • Updated test cases to expect correct HTTP status codes (400 instead of 500) for invalid input scenarios.
  • Chores

    • Enhanced test scripts, configuration, and environment variable handling for improved test isolation and reproducibility.
    • Added new test setup and configuration files to support the RnP framework and snapshot testing.
  • Documentation

    • Added a detailed guide explaining the RnP testing workflow, conventions, and best practices.

Tests performed by the developer:
pnpm test-record (changes files intentionally)
pnpm test rnp

Tips for QA testing:

  1. run pnpm test - verify that all tests pass
  2. run pnpm test rnp - verify that only tests with rnp in the name are run and pass
  3. run pnpm test-play - verify that only play tests are run and pass
  4. run pnpm test-record - verify that rnpExample mock files and snapshot file changes change
  5. run pnpm test-play - verify that only rnp tests are run and pass
  6. revert changes to rnpExample.test.ts.snap
  7. run pnpm test-play - verify that rnpExample play tests relying on mocks fail
  8. revert all changes to mock files
  9. run pnpm test-play - verify that tests pass

@WuonParticle WuonParticle changed the title Feat/record and play Feat/record and play framework Jul 17, 2025
@WuonParticle WuonParticle changed the base branch from main to development July 17, 2025 21:57
@WuonParticle WuonParticle force-pushed the feat/record_and_play branch from 3cdeed9 to 3105bf2 Compare July 17, 2025 21:59
@WuonParticle WuonParticle marked this pull request as draft July 18, 2025 16:29
@WuonParticle WuonParticle force-pushed the feat/record_and_play branch 3 times, most recently from 672c179 to 6d8b2e3 Compare July 18, 2025 21:05
@WuonParticle WuonParticle marked this pull request as ready for review July 18, 2025 22:23
@WuonParticle WuonParticle marked this pull request as draft July 24, 2025 23:08
@WuonParticle WuonParticle force-pushed the feat/record_and_play branch from cc96cde to 9bd329a Compare July 25, 2025 00:47
@WuonParticle WuonParticle marked this pull request as ready for review July 25, 2025 00:50
@WuonParticle
Copy link
Contributor Author

Separated the "Play" tests from the primary test suite today with 9bd329a as LLM agents were running the unit test suite with -u to force snapshots to avoid having to actually debug issues. Also clarified everywhere "Record" and "Play" Tests rather than saying unit.

@WuonParticle
Copy link
Contributor Author

I recommend doing a squash merge when eventually merging this as 42 commits is pretty outrageous for the functionality being added. However, I think keeping the git history in the PR is important for posterity and to understand why some design decisions were made.

… clarify explicitly that the output varies between the two.
…rd-and-play files under test/ . Prevent snapshot updates during "Play" tests.
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