Skip to content

Convert smoke tests to fixture-based Jest tests#141

Open
JSv4 wants to merge 5 commits intomainfrom
feat/smoke-test-fixtures
Open

Convert smoke tests to fixture-based Jest tests#141
JSv4 wants to merge 5 commits intomainfrom
feat/smoke-test-fixtures

Conversation

@JSv4
Copy link
Copy Markdown
Contributor

@JSv4 JSv4 commented Mar 27, 2026

Summary

  • Refactors 4 testing_scripts to export their core logic as functions while preserving npm run print:* console output via require.main === module
  • Captures current outputs as JSON fixtures in testing_scripts/fixtures/
  • Adds testing_scripts/tests/smoke_tests.test.ts with 4 tests asserting against those fixtures
  • Adds Jest moduleNameMapper entries for vesting_schedule_generator_v1, iso_nso_calculator, and read_ocf_package bare imports
  • Enables resolveJsonModule in tsconfig for fixture imports
  • Includes capture_fixtures.ts script to regenerate fixtures when needed

Total test count: 170 (166 existing + 4 new)

Test plan

  • npm run build passes
  • All 170 tests pass (npx jest)
  • npm run print:vesting_schedule, print:vesting_status, print:iso_calculator still produce console output

JSv4 added 3 commits March 27, 2026 11:11
Extract core logic from testing_scripts into exported functions
while preserving console output when run directly. Generate JSON
fixture files from current outputs for use in upcoming tests.
Convert smoke test scripts into proper Jest tests that assert
against captured JSON fixtures. Add missing Jest moduleNameMapper
entries for bare module imports and enable resolveJsonModule.
@JSv4 JSv4 changed the base branch from feat/ci-workflow to main March 27, 2026 16:51
JSv4 added 2 commits March 27, 2026 11:54
Pin TZ=UTC in jest.config.js and regenerate fixtures in UTC so
date serialization is consistent across local and CI environments.
@JSv4
Copy link
Copy Markdown
Contributor Author

JSv4 commented Mar 27, 2026

@arthur-clara, turned the existing console tests into tests we can run in CI. Assumed the current outputs are correct and generated fixtures from them.

@JSv4 JSv4 requested a review from arthur-clara March 27, 2026 17:08
@MattCantor
Copy link
Copy Markdown
Contributor

MattCantor commented Apr 1, 2026

Heads up - my PR #142 removes vesting_schedule_generator/, vesting_schedule_generator_v1/, and iso_nso_calculator/, along with the testing scripts that depend on them. If #142 merges, the smoke tests and fixtures in this PR would no longer have anything to run against.

That said, I think the approach here of capturing output as fixtures and running regression tests against them would be valuable applied to the remaining tools (ocf_validator, ocf_snapshot)

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.

2 participants