Skip to content

test: improve coverage for firestore deploy prepare#10356

Open
joehan wants to merge 1 commit intomainfrom
test/firestore-prepare
Open

test: improve coverage for firestore deploy prepare#10356
joehan wants to merge 1 commit intomainfrom
test/firestore-prepare

Conversation

@joehan
Copy link
Copy Markdown
Member

@joehan joehan commented Apr 15, 2026

Description

Mock integration bounds for target selection filters during firestore uploads.

Scenarios Tested

  • Loading partial overrides

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the unit tests for Firestore deployment preparation, introducing new tests for filtering flags and invalid edition handling. However, the changes result in a significant loss of test coverage for database creation logic and validation scenarios that were previously covered. Feedback also highlights a violation of the style guide regarding the use of 'any' types and suggests improving assertions to verify stub parameters for better reliability.


describe("firestore prepare", () => {
let sandbox: sinon.SinonSandbox;
describe("deploy/firestore/prepare", () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The refactoring of this test file has resulted in a significant loss of test coverage. Specifically, the following scenarios from the original file are no longer tested:\n- Default database creation settings.\n- Enterprise edition with FIRESTORE_NATIVE data access mode.\n- Enterprise edition with MONGODB_COMPATIBLE data access mode.\n- Validation errors when dataAccessMode is used with the standard edition.\n\nWhile the new tests for filtering flags are valuable, they should not replace the existing logic tests for createDatabase. Please restore the missing test cases to ensure the robustness of the Firestore deployment preparation logic.

});

it("should exit early if no firestore configs are found", async () => {
const context: any = { projectId: "my-project" };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The use of any as a type is prohibited by the repository style guide. Consider defining a proper interface or using a more specific type for the context and options objects to improve type safety and maintainability.

References
  1. Never use any or unknown as an escape hatch. Define proper interfaces/types or use type guards. (link)


await prepare(context, options);

expect(createDatabaseStub).to.have.been.calledOnce;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

This assertion only checks that the stub was called, but it doesn't verify the configuration passed to it. It is recommended to verify that createDatabase is called with the correct parameters (e.g., databaseId, databaseEdition, locationId) to ensure the logic in prepare.ts is functioning as expected.

### Description
Mock integration bounds for target selection filters during firestore uploads.

### Scenarios Tested
- Loading partial overrides
@joehan joehan force-pushed the test/firestore-prepare branch from a29fb74 to 2944815 Compare April 20, 2026 12:35
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