Repository navigation
Fix test suite (failing on every PR since Sept 2025) - #7
Merged
Merged
Conversation
The Run Tests workflow has failed on every PR since September 2025. - SlackOAuthService constructed EbbEncryption at import time, so every test file crashed on load when SLACK_ENCRYPTION_KEY was unset. Construct it lazily on first encrypt/decrypt instead. - Update tests that drifted from the code: LicenseService now checks getLicenseByUserId, LicenseRepo.updateLicenseByStripePaymentId was renamed to updateLicenseByCustomerId, checkout updates now set expiration_date to null, and the Discord weekly-report embed title changed. - Bun's mock.module applies to every test file in the run. The LicenseRepo stubs in two files leaked into the checkout e2e tests and the NotificationEngine stub leaked into WebhookService tests. Use spies for LicenseRepo and restore the real modules in afterAll for the notification tests. - Allow TEST_DB_PORT to override the test database port for local runs where 5433 is already taken. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Run Tests workflow has failed on every PR since September 2025, so the CVE PRs (#5, #6) show red checks for reasons unrelated to their changes. This PR gets the suite to 114/114 passing.
Import-time crash (the CI failure)
SlackOAuthServicebuilt anEbbEncryptionat module load, which throws whenSLACK_ENCRYPTION_KEYis unset. Every test file imports the app, so all 13 files died before running a single test. It is now constructed lazily on firstencrypt/decrypt.Stale tests
LicenseService.startFreeTrialchecksgetLicenseByUserId, notgetActiveLicenseByUserId.LicenseRepo.updateLicenseByStripePaymentIdwas renamed toupdateLicenseByCustomerId.expiration_date: null(commit 9c176e0).📊 Weekly Report Reminder.mock.moduleleaks between filesBun's
mock.modulereplaces a module for the whole run, not just the current file. Two license-repo stubs leaked into the checkout e2e tests, and the idempotency test'sNotificationEnginestub leaked into theWebhookServicetests. Fixed by usingspyOnforLicenseRepoand restoring the real modules inafterAllfor the notification tests.Local convenience
TEST_DB_PORTcan override the test database port when 5433 is taken locally. CI behaviour is unchanged.Test plan
bun testlocally: 114 pass, 0 fail, two consecutive runs🤖 Generated with Claude Code