Skip to content

Fix Admin API tests#4571

Merged
calculuschild merged 5 commits intonaturalcrit:masterfrom
G-Ambatte:fixLocalAdminAPITests
Feb 17, 2026
Merged

Fix Admin API tests#4571
calculuschild merged 5 commits intonaturalcrit:masterfrom
G-Ambatte:fixLocalAdminAPITests

Conversation

@G-Ambatte
Copy link
Copy Markdown
Collaborator

@G-Ambatte G-Ambatte commented Dec 29, 2025

The Admin API unit tests have been failing when run locally.

Investigation has shown that the new dbCheck middleware has been capturing the API calls because the database connection state is not ready (1). This is because the test file does not actually connect to the database at all, instead mocking all database calls.

This is NOT an issue when testing in CircleCI, as the dbCheck middleware contains an exception for test environments. However, when testing locally with the environment set to "local", the tests will fail.

This PR manually sets the readyState to 1 before each Admin API test, then restores the original value afterwards.

@G-Ambatte G-Ambatte self-assigned this Dec 29, 2025
@G-Ambatte G-Ambatte added bug We say this works but it doesn't P3 - low priority Obscure tweak or fix for a single user 🔍 R0 - Needs first review 👀 PR ready but has not been reviewed labels Dec 29, 2025
Copy link
Copy Markdown
Member

@5e-Cleric 5e-Cleric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems alright to me, and is passing the tests

@5e-Cleric 5e-Cleric moved this from Backlog to Waiting for Calc's First Review in @calculuschild's backlog Jan 3, 2026
@calculuschild calculuschild temporarily deployed to homebrewery-pr-4571 February 17, 2026 01:51 Inactive
@calculuschild calculuschild merged commit 93b43d4 into naturalcrit:master Feb 17, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Waiting for Calc's First Review to Done in @calculuschild's backlog Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug We say this works but it doesn't P3 - low priority Obscure tweak or fix for a single user 🔍 R0 - Needs first review 👀 PR ready but has not been reviewed

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants