Skip to content

dataconnect: add tests for user-defined enum support #7173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 22, 2025

Conversation

dconeybe
Copy link
Contributor

@dconeybe dconeybe commented Jul 22, 2025

This pull request adds test coverage for user-defined enum support in Data Connect. It includes new GraphQL schema definitions and operations to handle various enum configurations, such as nullable and non-nullable fields, lists of enums, default values, and enums serving as primary keys. The changes are backed by integration and unit tests that validate the correct behavior, serialization, and deserialization of these enum types both in the core sdk and the generated sdk.

This comment was marked as off-topic.

Copy link
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.

Summary of Changes

Hello @dconeybe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Firebase DataConnect system by introducing comprehensive test coverage for user-defined enum support. It includes new GraphQL schema definitions and operations to handle various enum configurations, such as nullable and non-nullable fields, lists of enums, default values, and enums serving as primary keys. The changes are backed by extensive integration and unit tests that validate the correct behavior, serialization, and deserialization of these enum types across both the DataConnect client and connector components.

Highlights

  • Enhanced Enum Support Testing: Added a comprehensive suite of integration and unit tests to validate the functionality of user-defined enums in various contexts within the DataConnect system.
  • GraphQL Schema and Operations Expansion: Introduced new GraphQL enum types and table definitions, along with corresponding mutations and queries, to fully support diverse enum usage patterns, including nullable/non-nullable fields, lists, and default values.
  • Serialization/Deserialization Validation: Included specific unit tests for EnumValue.Known, EnumValue.Unknown, and EnumValueSerializer to ensure robust and correct handling of enum serialization and deserialization, including unknown enum values.
  • Advanced Enum Scenarios: Covered advanced testing scenarios such as enums used as primary keys, enums with names conflicting with Kotlin keywords, and the behavior of enums within lists.
  • Property-Based Testing Utilities: Introduced new utility functions and data structures for property-based testing, improving the robustness and coverage of the new enum tests.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
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 PR adds a comprehensive set of tests for user-defined enum support in Data Connect. I've identified a redundant GraphQL query and a few tests with incorrect assertions or logic, particularly around nullability in lists and type mismatches in assertions. Addressing these will improve the robustness of the test suite.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jul 22, 2025

@google-oss-bot

This comment was marked as off-topic.

@dconeybe
Copy link
Contributor Author

/gemini review

@dconeybe dconeybe requested a review from Copilot July 22, 2025 20:53
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive test coverage for user-defined enum support in Firebase Data Connect. It introduces new GraphQL schema definitions and operations to validate enum handling across various configurations including nullable/non-nullable fields, lists, defaults, and enums as primary keys.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
demo_schema.gql Adds enum type definitions and table schemas for comprehensive enum testing
demo_ops.gql Defines GraphQL operations (queries/mutations) for enum table interactions
EnumIntegrationTest.kt (firebase-dataconnect) Core SDK integration tests for enum serialization/deserialization
EnumIntegrationTest.kt (connectors) Generated SDK integration tests using type-safe operations
EnumValueKnownUnitTest.kt Unit tests for the EnumValue.Known class behavior
EnumValueUnknownUnitTest.kt Unit tests for the EnumValue.Unknown class behavior
EnumValueSerializerUnitTest.kt Unit tests for enum value serialization/deserialization
WithNullAppendedUnitTest.kt Unit tests for utility function that appends null to collections
WithNullAppended.kt Utility functions for appending null to collections
tuples.kt Data classes and utilities for property-based testing with multiple values
misc.kt Additional arbitrary value generators for testing
connectors.gradle.kts Adds kotlinx serialization JSON dependency for tests
Comments suppressed due to low confidence (4)

firebase-dataconnect/connectors/src/test/kotlin/com/google/firebase/dataconnect/connectors/demo/EnumValueUnknownUnitTest.kt:50

  • This test is ignored due to a TODO dependency on cl/785477120. Consider adding a tracking issue or timeline for when this test can be re-enabled.
  @Ignore(

firebase-dataconnect/src/androidTest/kotlin/com/google/firebase/dataconnect/EnumIntegrationTest.kt:604

  • This test is ignored due to an emulator crash. Consider adding monitoring or a timeline for when the underlying issue will be resolved.
  @Ignore(

firebase-dataconnect/connectors/src/androidTest/kotlin/com/google/firebase/dataconnect/connectors/demo/EnumIntegrationTest.kt:452

  • This test is ignored due to a serialization issue with multiple enum types. Consider adding a tracking mechanism for when this can be re-enabled.
  @Ignore(

firebase-dataconnect/connectors/src/androidTest/kotlin/com/google/firebase/dataconnect/connectors/demo/EnumIntegrationTest.kt:432

  • This test is ignored due to the same emulator crash as the core SDK test. Consider consolidating or referencing the same tracking issue.
  @Ignore(

Copy link
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 adds comprehensive test coverage for user-defined enum support in Data Connect. The changes include new GraphQL schema definitions, operations, and a suite of integration and unit tests covering various enum configurations. Some tests have incorrect assertions about inserting null values into non-nullable lists, and others could be strengthened by running for more iterations.

@dconeybe dconeybe requested a review from aashishpatil-g July 22, 2025 21:38
@dconeybe dconeybe enabled auto-merge (squash) July 22, 2025 21:45
@dconeybe dconeybe merged commit b03038d into main Jul 22, 2025
48 checks passed
@dconeybe dconeybe deleted the dconeybe/dataconnect/UserDefinedEnumsCodegenAndTests branch July 22, 2025 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants