20 KiB
20 KiB
Test Migration Tracker
Track the progress of migrating test files from global state to isolated test context.
Migration Status
Legend:
- ✅ = Migrated and passing
- 🚧 = In progress
- ⏳ = Not started
- ⚠️ = Needs review
- ❌ = Skipped/Archived
Test Files to Migrate
Basic Tests
- ✅
tests/attach/basic/basic1.test.ts- Migrated - ✅
tests/attach/basic/basic2.test.ts- Migrated (renamed from basic4) - ✅
tests/attach/basic/basic3.test.ts- Migrated (renamed from basic5) - ✅
tests/attach/basic/basic6.test.ts- Migrated - ✅
tests/attach/basic/basic7.test.ts- Migrated - ✅
tests/attach/basic/basic8.test.ts- Migrated - ✅
tests/attach/basic/basic9.test.ts- Migrated - ✅
tests/attach/basic/basic10.test.ts- Migrated
Downgrade Tests
- ✅
tests/attach/downgrade/downgrade5.test.ts- Migrated (global→isolated with shared products) - ✅
tests/attach/downgrade/downgrade6.test.ts- Migrated (global→isolated with shared products) - ✅
tests/attach/downgrade/downgrade7.test.ts- Migrated (global→isolated with shared products)
Multi-Product Tests
- ⏳
tests/attach/multiProduct/multiProduct1.ts - ⏳
tests/attach/multiProduct/multiProduct2.ts
Other Tests
- ⏳
tests/attach/others/others4.ts - ⏳
tests/attach/others/others5.ts
Upgrade (Old) Tests
- ⏳
tests/attach/upgradeOld/upgradeOld1.ts - ⏳
tests/attach/upgradeOld/upgradeOld2.ts - ⏳
tests/attach/upgradeOld/upgradeOld3.ts - ⏳
tests/attach/upgradeOld/upgradeOld4.ts
Core Tests
- ⏳
tests/core/cancel/cancel5.test.ts
Continuous Use Tests
- ⏳
tests/contUse/track/track5.ts
Advanced Tests
- ⏳
tests/advanced/coupons/coupon1.ts - ⏳
tests/advanced/multiFeature/multiFeature1.ts - ⏳
tests/advanced/multiFeature/multiFeature2.ts - ⏳
tests/advanced/multiFeature/multiFeature3.ts
Archived Tests (Review if needed)
- ❌
tests/archives/arrear_prorated/arrear_prorated2.ts - ❌
tests/archives/arrear_prorated/arrear_prorated3.ts - ❌
tests/archives/coupon1 copy.ts
Utility Files (Don't Migrate)
These are helper files, not tests:
tests/utils/compare.tstests/utils/advancedUsageUtils.ts
Migration Prompt
When ready to migrate a file, use this prompt:
Migrate the test file [FILE_PATH] from using global state to isolated test context.
Reference the migration guide at @server/tests/MIGRATION_GUIDE.md for the full pattern.
**Critical Requirements:**
1. DO NOT remove any existing test logic - preserve ALL test cases and assertions
2. DO NOT remove any force_checkout tests or other edge case tests
3. Compare line-by-line with the original file to ensure nothing is lost
4. Replace the original file (not create a .new.test.ts file)
5. Update testCase ID to match original (e.g., "basic2" not "basic2-new")
After migration, run: `bun test [FILE_PATH]` to verify all tests pass.
Recent Progress (2025-10-24)
Migration Tests
- ✅
tests/attach/migrations/migration1.test.ts- Mocha→Bun migration - ✅
tests/attach/migrations/migration2.test.ts- Mocha→Bun migration - ✅
tests/attach/migrations/migration3.test.ts- Mocha→Bun migration - ✅
tests/attach/migrations/migration4.test.ts- Mocha→Bun migration - ✅
tests/attach/migrations/runMigrationTest.ts- Chai→Bun assertions
Shared Products Created
- ✅
tests/attach/downgrade/sharedProducts.ts- Created shared products for downgrade tests
Final Status (2025-10-24)
G1.sh Test Suite Status
All 48 test files verified using Bun test framework:
- ✅ tests/check/basic (10 files)
- ✅ tests/attach/basic (6 files)
- ✅ tests/attach/upgrade (7 files)
- ✅ tests/attach/downgrade (7 files)
- ✅ tests/attach/free (2 files)
- ✅ tests/attach/addOn (2 files)
- ✅ tests/attach/entities (5 files)
- ✅ tests/attach/checkout (8 files)
G2.sh Test Suite Status
All 35 active test files migrated to Bun:
- ✅ Migrations (5 files)
- ✅ NewVersion (3 files)
- ✅ UpgradeOld (5 files including sharedProducts)
- ✅ Others (8 files, 1 deleted)
- ✅ UpdateEnts (5 files including utility)
- ✅ Prepaid (5 files, 2 commented out)
- ✅ Advanced/check (1 file)
- ✅ Interval/upgrade (3 files)
- ✅ Interval/multiSub (3 files)
- ✅ Interval utility (1 file)
Progress Summary
- Total Test Files in g1+g2: 83
- Migrated: 83 (100%)
- In Progress: 0 (0%)
- Remaining: 0 (0%)
✅ G2.sh Migration Complete! (All 35 files migrated)
Migration Tests (5 files)
- ✅
tests/attach/migrations/migration1.test.ts- Mocha→Bun - ✅
tests/attach/migrations/migration2.test.ts- Mocha→Bun - ✅
tests/attach/migrations/migration3.test.ts- Mocha→Bun - ✅
tests/attach/migrations/migration4.test.ts- Mocha→Bun - ✅
tests/attach/migrations/runMigrationTest.ts- Utility (Chai→Bun)
NewVersion Tests (3 files)
- ✅
tests/attach/newVersion/newVersion1.test.ts- Mocha→Bun + global→isolated - ✅
tests/attach/newVersion/newVersion2.test.ts- Mocha→Bun - ✅
tests/attach/newVersion/newVersion3.test.ts- Already migrated
UpgradeOld Tests (5 files)
- ✅
tests/attach/upgradeOld/upgradeOld1.test.ts- Mocha→Bun + global→isolated - ✅
tests/attach/upgradeOld/upgradeOld2.test.ts- Mocha→Bun + global→isolated - ✅
tests/attach/upgradeOld/upgradeOld3.test.ts- Mocha→Bun + global→isolated - ✅
tests/attach/upgradeOld/upgradeOld4.test.ts- Mocha→Bun + global→isolated - ✅
tests/attach/upgradeOld/sharedProducts.ts- Created for global→isolated migration
Others Tests (9 files)
- ✅
tests/attach/others/others1.test.ts- Mocha→Bun - ✅
tests/attach/others/others2.test.ts- Mocha→Bun - ✅
tests/attach/others/others3.test.ts- Mocha→Bun - ✅
tests/attach/others/others4.ts- Deleted (was commented out) - ✅
tests/attach/others/others5.test.ts- Mocha→Bun - ✅
tests/attach/others/others6.test.ts- Mocha→Bun - ✅
tests/attach/others/others7.test.ts- Mocha→Bun - ✅
tests/attach/others/others8.test.ts- Mocha→Bun - ✅
tests/attach/others/others9.test.ts- Mocha→Bun
UpdateEnts Tests (5 files)
- ✅
tests/attach/updateEnts/updateEnts1.test.ts- Mocha→Bun - ✅
tests/attach/updateEnts/updateEnts2.test.ts- Mocha→Bun - ✅
tests/attach/updateEnts/updateEnts3.test.ts- Mocha→Bun - ✅
tests/attach/updateEnts/updateEnts4.test.ts- Mocha→Bun - ✅
tests/attach/updateEnts/expectUpdateEnts.ts- Utility (Chai→Bun)
Prepaid Tests (7 files)
- ✅
tests/attach/prepaid/prepaid1.test.ts- Mocha→Bun - ✅
tests/attach/prepaid/prepaid2.test.ts- Mocha→Bun - ✅
tests/attach/prepaid/prepaid3.test.ts- Mocha→Bun - ✅
tests/attach/prepaid/prepaid4.test.ts- Mocha→Bun - ✅
tests/attach/prepaid/prepaid5.test.ts- Mocha→Bun - 🔕
tests/attach/prepaid/prepaid6.ts- Commented out (not migrated) - 🔕
tests/attach/prepaid/prepaid7.ts- Commented out (not migrated)
Advanced Tests (1 file)
- ✅
tests/advanced/check/check1.test.ts- Mocha→Bun
Interval Tests (7 files)
- ✅
tests/interval/upgrade/interval1.test.ts- Mocha→Bun - ✅
tests/interval/upgrade/interval2.test.ts- Mocha→Bun - ✅
tests/interval/upgrade/interval3.test.ts- Mocha→Bun - ✅
tests/interval/multiSub/multiSubInterval1.test.ts- Mocha→Bun - ✅
tests/interval/multiSub/multiSubInterval2.test.ts- Mocha→Bun - ✅
tests/interval/multiSub/multiSubInterval3.test.ts- Mocha→Bun - ✅
tests/interval/intervalUtils1.test.ts- Mocha→Bun
G3 Migration Complete! (All 19 files)
contUse/entities (5 files)
- ✅
tests/contUse/entities/entity1.test.ts- Mocha→Bun - ✅
tests/contUse/entities/entity2.test.ts- Mocha→Bun - ✅
tests/contUse/entities/entity3.test.ts- Mocha→Bun - ✅
tests/contUse/entities/entity4.test.ts- Mocha→Bun - ✅
tests/contUse/entities/entity5.test.ts- Mocha→Bun
contUse/update (5 files)
- ✅
tests/contUse/update/updateContUse1.test.ts- Mocha→Bun - ✅
tests/contUse/update/updateContUse2.test.ts- Mocha→Bun - ✅
tests/contUse/update/updateContUse3.test.ts- Mocha→Bun - ✅
tests/contUse/update/updateContUse4.test.ts- Mocha→Bun - ✅
tests/contUse/update/updateContUse5.test.ts- Mocha→Bun
contUse/track (6 files)
- ✅
tests/contUse/track/track1.test.ts- Mocha→Bun - ✅
tests/contUse/track/track2.test.ts- Mocha→Bun - ✅
tests/contUse/track/track3.test.ts- Mocha→Bun - ✅
tests/contUse/track/track4.test.ts- Mocha→Bun - ✅
tests/contUse/track/track5.test.ts- Mocha→Bun - ✅
tests/contUse/track/track6.test.ts- Mocha→Bun
contUse/roles (3 files)
- ✅
tests/contUse/roles/role1.test.ts- Mocha→Bun - ✅
tests/contUse/roles/role2.test.ts- Mocha→Bun - ✅
tests/contUse/roles/role3.test.ts- Mocha→Bun
G4 Migration Complete! (All 47 files)
merged/downgrade (8 files)
- ✅
tests/merged/downgrade/mergedDowngrade1.test.ts- Mocha→Bun - ✅
tests/merged/downgrade/mergedDowngrade2.test.ts- Mocha→Bun - ✅
tests/merged/downgrade/mergedDowngrade3.test.ts- Mocha→Bun - ✅
tests/merged/downgrade/mergedDowngrade4.test.ts- Mocha→Bun - ✅
tests/merged/downgrade/mergedDowngrade5.test.ts- Already migrated - ✅
tests/merged/downgrade/mergedDowngrade6.test.ts- Already migrated - ✅
tests/merged/downgrade/mergedDowngrade8.test.ts- Mocha→Bun - ✅
tests/merged/downgrade/mergedDowngrade9.test.ts- Mocha→Bun
merged/prepaid (3 files)
- ✅
tests/merged/prepaid/mergedPrepaid1.test.ts- Mocha→Bun - ✅
tests/merged/prepaid/mergedPrepaid2.test.ts- Mocha→Bun - ✅
tests/merged/prepaid/mergedPrepaid3.test.ts- Mocha→Bun
Other merged/core directories (36 files - all already migrated)
- ✅ merged/group (2 files)
- ✅ merged/add (3 files)
- ✅ merged/separate (2 files)
- ✅ merged/upgrade (4 files)
- ✅ merged/trial (8 files)
- ✅ merged/addOn (6 files)
- ✅ core/cancel (8 files)
- ✅ core/multiAttach (6 files + subdirectories)
- ✅ core/reset (1 file)
Utility Files Updated:
- ✅
tests/merged/mergeUtils/expectSubCorrect.ts- Chai→Bun assertions (kept as .ts)
G5 Migration Complete! (34 files migrated, but only 19 in g5.sh script)
multiProduct (2 files + sharedProducts)
- ✅
tests/attach/multiProduct/multiProduct1.test.ts- Mocha→Bun + global→isolated - ✅
tests/attach/multiProduct/multiProduct2.test.ts- Mocha→Bun + global→isolated - ✅
tests/attach/multiProduct/sharedProducts.ts- Created
usage (4 files + sharedProducts)
- ✅
tests/advanced/usage/usage1.test.ts- Mocha→Bun + global→isolated - ✅
tests/advanced/usage/usage2.test.ts- Mocha→Bun (GPU products still use global) - ✅
tests/advanced/usage/usage3.test.ts- Mocha→Bun (GPU products still use global) - ✅
tests/advanced/usage/usage4.test.ts- Mocha→Bun (GPU products still use global) - ✅
tests/advanced/usage/sharedProducts.ts- Created
coupons (3 files)
- ✅
tests/advanced/coupons/coupon1.test.ts- Mocha→Bun - ✅
tests/advanced/coupons/coupon2.test.ts- Mocha→Bun - ✅
tests/advanced/coupons/coupon3.test.ts- Mocha→Bun
referrals (4 files)
- ✅
tests/advanced/referrals/referrals1.test.ts- Mocha→Bun - ✅
tests/advanced/referrals/referrals2.test.ts- Mocha→Bun - ✅
tests/advanced/referrals/referrals3.test.ts- Mocha→Bun - ✅
tests/advanced/referrals/referrals4.test.ts- Mocha→Bun
referrals/paid (4 files)
- ✅
tests/advanced/referrals/paid/referrals13.test.ts- Mocha→Bun - ✅
tests/advanced/referrals/paid/referrals14.test.ts- Mocha→Bun - ✅
tests/advanced/referrals/paid/referrals15.test.ts- Mocha→Bun - 🔕
tests/advanced/referrals/paid/referrals16.test.ts- Commented out
updateQuantity (1 file)
- ✅
tests/attach/updateQuantity/updateQuantity1.test.ts- Mocha→Bun
rollovers (6 files) ⚠️ NOT IN g5.sh SCRIPT
- ✅
tests/advanced/rollovers/rollover1.test.ts- Mocha→Bun (migrated but not in g5.sh) - ✅
tests/advanced/rollovers/rollover2.test.ts- Mocha→Bun (migrated but not in g5.sh) - ✅
tests/advanced/rollovers/rollover3.test.ts- Mocha→Bun (migrated but not in g5.sh) - ✅
tests/advanced/rollovers/rollover4.test.ts- Mocha→Bun (migrated but not in g5.sh) - ✅
tests/advanced/rollovers/rollover5.test.ts- Mocha→Bun (migrated but not in g5.sh) - ✅
tests/advanced/rollovers/rollover6.test.ts- Mocha→Bun (migrated but not in g5.sh)
customInterval (5 files) ⚠️ NOT IN g5.sh SCRIPT
- ✅
tests/advanced/customInterval/customInterval1.test.ts- Mocha→Bun (migrated but not in g5.sh) - ✅
tests/advanced/customInterval/customInterval2.test.ts- Mocha→Bun (migrated but not in g5.sh) - ✅
tests/advanced/customInterval/customInterval3.test.ts- Mocha→Bun (migrated but not in g5.sh) - ✅
tests/advanced/customInterval/customInterval4.test.ts- Mocha→Bun (migrated but not in g5.sh) - ✅
tests/advanced/customInterval/customInterval5.test.ts- Mocha→Bun (migrated but not in g5.sh) - 🔕
tests/advanced/customInterval/customInterval6.ts- Empty file (skipped)
usageLimit (4 files) ⚠️ NOT IN g5.sh SCRIPT
- ✅
tests/advanced/usageLimit/usageLimit1.test.ts- Mocha→Bun (migrated but not in g5.sh) - ✅
tests/advanced/usageLimit/usageLimit2.test.ts- Mocha→Bun (migrated but not in g5.sh) - ✅
tests/advanced/usageLimit/usageLimit3.test.ts- Mocha→Bun (migrated but not in g5.sh) - ✅
tests/advanced/usageLimit/usageLimit4.test.ts- Mocha→Bun (migrated but not in g5.sh)
G5 Not Migrated (not in g5.sh script):
- ⏸️
tests/advanced/multiFeature/multiFeature1.ts(uses old ProductV1 structure) - ⏸️
tests/advanced/multiFeature/multiFeature2.ts(uses old ProductV1 structure) - ⏸️
tests/advanced/multiFeature/multiFeature3.ts(uses old ProductV1 structure)
⚠️ ACTION REQUIRED: The g5.sh comment says "rollovers, customInterval, usageLimit still use Mocha (not migrated yet)" but these 15 files ARE migrated. Either:
- Add these directories to g5.sh script, OR
- Create a new test group (g7.sh) for these migrated advanced tests
G6 - Alex Tests (⏳ NOT MIGRATED - Still Using Mocha)
Alex Integration Tests (6 test files)
- ⏳
tests/alex/01_free.ts- Uses Mocha (not migrated) - ⏳
tests/alex/02_pro.ts- Uses Mocha (not migrated) - ⏳
tests/alex/03_premium.ts- Uses Mocha (not migrated) - ⏳
tests/alex/04_topups.ts- Uses Mocha (not migrated) - ⏳
tests/alex/05_cancel.ts- Uses Mocha (not migrated) - ⏳
tests/alex/06_switch.ts- Uses Mocha (not migrated)
Utility Files (3 files)
tests/alex/00_setup.ts- Setup file (ignored in g6.sh)tests/alex/utils.ts- Helper utilitiestests/alex/init.ts- Initialization utilities
Note: g6.sh runs these tests using npx mocha --parallel with comment "will be migrated later"
Final Migration Summary
Totals:
- G1: 47 files ✅
- G2: 35 files ✅ (includes 7 interval tests)
- G3: 19 files ✅
- G4: 65 files ✅ (all merged/core tests)
- G5: 19 files in script ✅ + 15 files migrated but not in script ⚠️
- G6: 6 files ⏳ (NOT migrated - still using Mocha)
- Total Migrated to Bun: 219 files (204 in scripts + 15 orphaned)
- Total in Test Scripts (g1-g5): 185 files
- Not migrated:
- 3 files (multiFeature 1-3 - ProductV1 structure) ⏸️
- 6 files (alex tests - still using Mocha) ⏳
- 15 files (rollovers, customInterval, usageLimit - migrated but not in g5.sh) ⚠️
Helper Functions Created/Updated:
- ✅
checkUsageInvoiceAmountV2- V2 wrapper for usage invoice validation - ✅
expectSubCorrect.ts- Updated Chai→Bun assertions
Shared Products Files Created:
- ✅
tests/attach/basic/sharedProducts.ts(pre-existing) - ✅
tests/attach/downgrade/sharedProducts.ts - ✅
tests/attach/upgradeOld/sharedProducts.ts - ✅
tests/attach/multiProduct/sharedProducts.ts - ✅
tests/advanced/usage/sharedProducts.ts
Shell Scripts Status:
- ✅
scripts/testGroups/g1.sh- UsesBUN_PARALLEL_COMPACT(47 files) - ✅
scripts/testGroups/g2.sh- UsesBUN_PARALLEL_COMPACT(35 files, includes interval tests) - ✅
scripts/testGroups/g3.sh- UsesBUN_PARALLEL_COMPACT(19 files) - ✅
scripts/testGroups/g4.sh- UsesBUN_PARALLEL_COMPACT(65 files) - ⚠️
scripts/testGroups/g5.sh- UsesBUN_PARALLEL_COMPACT(19 files)- MISSING: rollovers (6), customInterval (5), usageLimit (4) directories
- Comment says these "still use Mocha" but they ARE migrated
- ⏳
scripts/testGroups/g6.sh- Usesnpx mocha --parallel(6 files, not migrated)
All before() → beforeAll() Replaced:
- ✅ Verified: 0 test files still using
before()(all occurrences replaced withbeforeAll()) - ✅ All test files now use proper Bun test syntax
Cleanup Actions Completed:
- ✅ Deleted 15 Mocha duplicate .ts files where .test.ts versions existed (coupons, referrals, usage)
- ✅ Renamed 1 Bun duplicate to .backup.ts (updateQuantity1.ts)
- ✅ Created backups for all newly migrated files
Migration Status:
- ✅ All ProductV1→ProductV2 conversions complete (except 3 multiFeature files + 6 alex files)
- ✅ All Mocha→Bun framework migrations complete (except 3 multiFeature files + 6 alex files)
- ✅ All global state → isolated migrations complete for migrated files
- ✅ All tests preserve original logic and assertions
- ✅ Test groups G1-G4 ready for parallel Bun execution
- ⚠️ G5 is partial - missing 15 migrated test files (rollovers, customInterval, usageLimit)
- ⏳ G6 (alex tests) still uses Mocha framework
🚨 CRITICAL DISCREPANCIES FOUND
Issue 1: G2 Missing Interval Tests in Tracker
Status: FIXED ✅
- Added 7 interval test files to tracker (interval/upgrade, interval/multiSub)
- Updated G2 count from 28 to 35 files
Issue 2: G5 - Orphaned Migrated Tests
Status: ⚠️ NEEDS ACTION
- 15 test files are migrated but NOT in g5.sh script:
tests/advanced/rollovers/(6 files)tests/advanced/customInterval/(5 files)tests/advanced/usageLimit/(4 files)
- g5.sh comment is outdated: Says these "still use Mocha (not migrated yet)" but they ARE migrated
- Action needed: Either add these to g5.sh OR create g7.sh for them
Issue 3: G6 Not Tracked
Status: FIXED ✅
- Added G6 section tracking 6 alex test files (still using Mocha)
- These are integration tests that will need migration later
Issue 4: Incorrect Total Counts
Status: FIXED ✅
- Old claim: "204 files migrated"
- Actual: 219 files migrated to Bun (but only 185 are in test scripts g1-g5)
- 15 orphaned files exist but aren't run by any script
📋 RECOMMENDED ACTIONS
-
Update g5.sh to include orphaned tests:
# Add to scripts/testGroups/g5.sh: BUN_PARALLEL_COMPACT \ 'server/tests/advanced/coupons' \ 'server/tests/attach/updateQuantity' \ 'server/tests/advanced/referrals' \ 'server/tests/advanced/referrals/paid' \ 'server/tests/attach/multiProduct' \ 'server/tests/advanced/usage' \ 'server/tests/advanced/rollovers' \ 'server/tests/advanced/customInterval' \ 'server/tests/advanced/usageLimit' \ --max=6 -
Update g5.sh comment:
- Remove: "Note: advanced/multiFeature, advanced/rollovers, advanced/customInterval, advanced/usageLimit still use Mocha (not migrated yet)"
- Replace: "Note: advanced/multiFeature still uses Mocha (not migrated yet)"
-
Consider migrating G6 (alex tests):
- 6 integration test files still using Mocha
- Would complete the Mocha→Bun migration (except multiFeature)
✅ VERIFIED COUNTS (Post-Sweep)
- G1: 47 files ✅ (matches script)
- G2: 35 files ✅ (matches script - corrected from 28)
- G3: 19 files ✅ (matches script)
- G4: 65 files ✅ (matches script)
- G5: 19 files in script, 15 files orphaned ⚠️
- G6: 6 files using Mocha ⏳
- Total in scripts (g1-g5): 185 files
- Total migrated to Bun: 219 files
- Orphaned (migrated but not in scripts): 15 files
- Still using Mocha: 9 files (3 multiFeature + 6 alex)