Skip to content

Clean up empty tests and migrate GemAPI test suite#1829

Open
DRadmir wants to merge 1 commit intomainfrom
codex/test-cleanup
Open

Clean up empty tests and migrate GemAPI test suite#1829
DRadmir wants to merge 1 commit intomainfrom
codex/test-cleanup

Conversation

@DRadmir
Copy link
Contributor

@DRadmir DRadmir commented Mar 25, 2026

No description provided.

@DRadmir DRadmir self-assigned this Mar 25, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 focuses on improving the project's testing infrastructure by removing unused and empty test files and upgrading the GemAPI test suite to a more modern and efficient testing framework. These changes aim to reduce project clutter, enhance test maintainability, and align with current best practices for Swift testing.

Highlights

  • Test Suite Migration: Migrated the GemAPI test suite, including DeviceRequestSignerTests and GemAPITests, from XCTest to the new Testing framework, updating test structure and assertions.
  • Test Cleanup: Removed several empty XCTest test files and their corresponding test targets from various packages (QRScanner, Settings, Components, Keystore, Style, SwiftHTTPClient) to streamline the project.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

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 pull request migrates several test files and their corresponding package configurations from XCTest to the swift-testing framework. This involved updating test class definitions, replacing XCTAssert assertions with #expect, and adapting error handling mechanisms. The review comments suggest further idiomatic improvements for error testing within the swift-testing framework, specifically recommending the use of #expect(throws:) for both synchronous and asynchronous error scenarios to enhance conciseness and clarity.

Comment on lines +51 to +54
do {
_ = try DeviceRequestSigner(privateKeyHex: "not_valid_hex")
Issue.record("Expected invalid hex to throw")
} catch {}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While this do-catch block works, swift-testing provides a more idiomatic way to test for thrown errors using #expect(throws:). This makes the test more concise and clearly states the intent. The DeviceRequestSigner initializer is expected to throw an AnyError for invalid hex input.

        #expect(throws: AnyError.self) {
            _ = try DeviceRequestSigner(privateKeyHex: "not_valid_hex")
        }

Comment on lines +71 to +76
do {
_ = try await service.getDeviceAssets(walletId: "wallet", fromTimestamp: 0)
Issue.record("Expected preflight to throw")
} catch {
#expect(events.snapshot().isEmpty)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Since this is an async test, you can use await #expect(throws:) to make the error handling more concise and idiomatic to swift-testing. This also makes the test's intent clearer.

            await #expect(throws: TestError.self) {
                _ = try await service.getDeviceAssets(walletId: "wallet", fromTimestamp: 0)
            }
            #expect(events.snapshot().isEmpty)

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