Skip to content
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

chore(connect): add types to e2e fixtures #16791

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

martykan
Copy link
Member

@martykan martykan commented Feb 4, 2025

Description

Check types in Connect fixtures using satisfies TestCase

Related Issue

Resolve #12721

Copy link

coderabbitai bot commented Feb 4, 2025

Walkthrough

All modified files now include an explicit type assertion on their default exported objects using the satisfies TestCase clause. This approach systematically enforces the exported objects to conform to the TestCase type across the E2E fixtures, without changing their internal logic or content. In addition, the globals.d.ts file has been updated so that both the Fixture and TestCase types now define a more structured setup property including optional wiped, mnemonic, and settings fields. These changes enhance type safety and ensure consistency throughout the E2E tests in the connect package.

Assessment against linked issues

Objective Addressed Explanation
Add type for fixtures in E2E tests (#12721)

Possibly related PRs

Suggested labels

connect, no-project

Suggested reviewers

  • szymonlesisz
  • mroz22
  • marekrjpolak

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@martykan martykan marked this pull request as ready for review February 4, 2025 09:41
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (3)
packages/connect/e2e/__fixtures__/tezosSignTransaction.ts (1)

93-115: Remove duplicate delegation operation test case.

The test case for delegation operation (lines 93-115) appears to be a duplicate of the origination operation test case above it. Both test cases have identical parameters and expected results, but different descriptions.

Consider removing the duplicate test case or updating it with the correct delegation operation parameters.

packages/connect/e2e/__fixtures__/ethereumSignTypedData.ts (1)

32-34: Issue #5181 is closed – please update the TODO comment accordingly.

The GitHub API indicates that issue #5181 ("Connect fixtures are not compatible with firmware master branch") is closed. Since the TODO comment in the file packages/connect/e2e/fixtures/ethereumSignTypedData.ts now references a closed issue, it should be revisited to reflect the current state (for example, by removing the comment or updating it to describe any next steps).

🔗 Analysis chain

TODO is tracked by an existing issue.

The comment references issue #5181 regarding newly added fixtures to trezor-common. This is properly tracked and can be addressed when the referenced issue is resolved.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the referenced issue is still open
gh issue view 5181

Length of output: 109


Script:

#!/bin/bash
# Query GitHub API for issue #5181 in the trezor-suite repository
curl -s https://api.github.com/repos/trezor/trezor-suite/issues/5181 | jq '.state, .title'

Length of output: 167

packages/connect/e2e/__fixtures__/getFeatures.ts (1)

6-6: Fix the Type Mismatch for emulatorStartOpts

It turns out the error is due to how emulatorStartOpts is obtained. When reading from the environment (i.e. process.env.emulatorStartOpts), the value is a string (or possibly undefined) rather than an object with a defined version property. In contrast, the global value is already typed as an object. Accessing .version directly thus triggers a TypeScript error. Instead of suppressing the error with @ts-expect-error, update the code so that if the environment variable is provided as a string, it’s properly parsed (or checked) into the expected object structure. For example:

  • Check if process.env.emulatorStartOpts is a string.
  • If it is, parse it (using JSON.parse) into the proper object type before accessing .version.
  • Otherwise, use the globally defined value.

This approach fixes the underlying type mismatch and makes the code type-safe.

🔗 Analysis chain

Investigate and fix the TypeScript error.

The comment suggests there might be a bug. Consider investigating and fixing the underlying TypeScript error instead of suppressing it.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find the TypeScript error that's being suppressed

# Search for the type definition of emulatorStartOpts
rg -A 5 "emulatorStartOpts" --type ts

Length of output: 10278

🧹 Nitpick comments (13)
packages/connect/e2e/__fixtures__/ethereumVerifyMessage.ts (1)

1-3: Consider adding type definitions for the imported fixtures.

Instead of using @ts-ignore, consider adding type definitions for the imported JSON fixtures. This would provide better type safety and IDE support.

packages/connect/e2e/__fixtures__/applySettings.ts (1)

1-1: Consider creating shared type definitions for fixture files.

To improve type safety across the codebase, consider:

  1. Creating a shared type definition file for the fixture JSON files in the trezor-common submodule.
  2. Using these type definitions instead of @ts-ignore directives.
  3. Adding a type-checking CI step to ensure fixture files match their type definitions.

This would provide better type safety, IDE support, and catch potential issues earlier in the development process.

packages/connect/e2e/__fixtures__/rippleGetAddress.ts (1)

33-40: Consider removing or updating the commented test case.

The comment indicates this test is no longer relevant since version 2.3.2. Consider either removing it or updating it to reflect current behavior.

packages/connect/e2e/__fixtures__/cardanoGetAddressDerivations.ts (1)

26-27: Consider improving type safety for untyped JSON imports.

The code uses @ts-expect-error to handle untyped JSON imports. Consider:

  1. Creating type definitions for the imported JSON.
  2. Using type assertions with proper interfaces.

Example type definition:

interface CardanoFixtureParameters {
    address_type: string;
    path: string;
    staking_path: string;
    derivation_type: string;
    network_id: number;
    protocol_magic: number;
}

interface CardanoFixtureResult {
    expected_address: string;
}

interface CardanoFixture {
    name: string;
    parameters: CardanoFixtureParameters;
    result: CardanoFixtureResult;
}

Also applies to: 31-32

packages/connect/e2e/__fixtures__/ethereumSignMessage.ts (1)

3-5: Consider using proper JSON module resolution.

Instead of using @ts-ignore, consider adding proper JSON module resolution in your TypeScript configuration.

Add the following to your tsconfig.json:

{
  "compilerOptions": {
+   "resolveJsonModule": true,
+   "esModuleInterop": true
  }
}
packages/connect/e2e/__fixtures__/getAddressMultisig.ts (1)

28-64: Consider making test cases more DRY.

The test cases are very similar, only differing in the path value. Consider generating them programmatically.

-    tests: [
-        {
-            description: 'show multisig address (1)',
-            params: {
-                path: [1],
-                multisig,
-                scriptType: 'SPENDMULTISIG',
-                showOnTrezor: true,
-            },
-            result: {
-                address: '3E7GDtuHqnqPmDgwH59pVC7AvySiSkbibz',
-            },
-        },
-        // ... similar test cases
-    ],
+    tests: [1, 2, 3].map(path => ({
+        description: `show multisig address (${path})`,
+        params: {
+            path: [path],
+            multisig,
+            scriptType: 'SPENDMULTISIG',
+            showOnTrezor: true,
+        },
+        result: {
+            address: '3E7GDtuHqnqPmDgwH59pVC7AvySiSkbibz',
+        },
+    })),
packages/connect/e2e/__fixtures__/ethereumSignTransactionEip1559.ts (1)

1-3: Consider removing TypeScript ignore comments.

The @ts-ignore comment suggests potential type issues with the imported JSON file. Consider adding proper type definitions for the imported fixtures instead of ignoring TypeScript checks.

-/* eslint-disable @typescript-eslint/ban-ts-comment */
-// @ts-ignore
+// TODO: Add type definitions for trezor-common fixtures
packages/connect/e2e/__fixtures__/getPublicKey.ts (1)

18-21: Consider using a discriminated union type for legacyResults.

The boolean success flag could be enhanced with a more descriptive type that includes the reason for failure.

 legacyResults: [
     {
         rules: ['<1.10.4', '<2.4.3'],
-        success: false,
+        success: false,
+        reason?: string, // Optional field to describe why it fails
     },
 ],
packages/connect/e2e/__fixtures__/signTransactionKomodo.ts (1)

1-1: Consider adding type definitions for TestUtils.

The global.TestUtils.TX_CACHE usage could benefit from proper TypeScript definitions to ensure type safety of the test utilities.

// Add to globals.d.ts or a separate types file
declare global {
    namespace TestUtils {
        interface TxCache {
            (hashes: string[], includeHex?: boolean): Record<string, unknown>;
        }
        const TX_CACHE: TxCache;
    }
}
packages/connect/e2e/__fixtures__/stellarSignTransaction.ts (1)

15-140: Consider enhancing error handling in transformation functions.

The transformation functions could benefit from more robust error handling, especially for invalid or unexpected input data.

Apply this diff to improve error handling:

 const transformOperation = (op: any) => {
+    if (!op || !op._message_type) {
+        throw new Error('Invalid operation: missing _message_type');
+    }
     switch (op._message_type) {
         // ... existing cases ...
         default:
-            return [];
+            throw new Error(`Unsupported operation type: ${op._message_type}`);
     }
 };
packages/connect/e2e/__fixtures__/signTransactionReplace.ts (1)

115-116: Address TODO comments and referenced issues.

There are two issues referenced in the code that should be addressed:

  1. Line 115: address should be replaced with address_n
  2. Line 192: script_type should not be undefined

These are referenced in issue #10474.

Would you like me to help implement the fixes for these issues?

Also applies to: 192-193

packages/connect/e2e/__fixtures__/signTransactionExternal.ts (1)

397-397: LGTM! Type assertion enhances type safety.

The addition of satisfies TestCase ensures compile-time type checking while preserving the exact type of the object. This is a good practice for test fixtures.

Consider extracting common test data (like chainId and header) into shared constants to reduce duplication across test cases.

packages/connect/e2e/__fixtures__/eosSignTransaction.ts (1)

779-779: LGTM! Type assertion enhances type safety.

The addition of satisfies TestCase ensures compile-time type checking while preserving the exact type of the object. This is a good practice for test fixtures.

Consider extracting common test data into shared constants:

  • Chain ID
  • Header structure
  • Authorization structure
    This would reduce duplication and make the tests more maintainable.

Example:

const TESTNET_CHAIN_ID = 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f';
const DEFAULT_HEADER = {
    expiration: '2018-07-14T10:43:28',
    refBlockNum: 6439,
    refBlockPrefix: 2995713264,
    maxNetUsageWords: 0,
    maxCpuUsageMs: 0,
    delaySec: 0,
};
const DEFAULT_AUTH = {
    actor: 'miniminimini',
    permission: 'active',
};
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c53ad7a and bf0ed33.

📒 Files selected for processing (75)
  • packages/connect/e2e/__fixtures__/applyFlags.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/applySettings.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/binanceGetAddress.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/binanceGetPublicKey.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/binanceSignTransaction.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/cardanoGetAddress.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/cardanoGetAddressDerivations.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/cardanoGetNativeScriptHash.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/cardanoGetPublicKey.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/cardanoSignTransaction.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/changeLanguage.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/composeTransaction.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/eosGetPublicKey.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/eosSignTransaction.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/ethereumGetAddress.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/ethereumGetPublicKey.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/ethereumSignMessage.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/ethereumSignTransaction.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/ethereumSignTransactionEip155.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/ethereumSignTransactionEip1559.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/ethereumSignTypedData.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/ethereumVerifyMessage.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/getAccountDescriptor.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/getAccountInfo.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/getAddress.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/getAddressMultisig.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/getAddressMultisigPubkeysOrder.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/getAddressSegwit.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/getFeatures.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/getFirmwareHash.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/getOwnershipId.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/getOwnershipProof.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/getPublicKey.ts (2 hunks)
  • packages/connect/e2e/__fixtures__/getPublicKeyBip48.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/loadDevice.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/nemGetAddress.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/nemSignTransactionMosaic.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/nemSignTransactionMultisig.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/nemSignTransactionOthers.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/nemSignTransactionTransfer.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/rippleGetAddress.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/rippleSignTransaction.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signMessage.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransaction.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionBcash.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionBech32.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionBgold.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionDash.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionDecred.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionDoge.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionExternal.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionKomodo.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionMultisig.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionMultisigChange.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionMultisigPubkeysOrder.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionPaymentRequest.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionPeercoin.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionReplace.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionSegwit.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionTaproot.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/signTransactionZcash.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/solanaComposeTransaction.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/solanaGetAddress.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/solanaGetPublicKey.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/solanaSignTransaction.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/stellarGetAddress.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/stellarSignTransaction.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/tezosGetAddress.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/tezosGetPublicKey.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/tezosSignTransaction.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/verifyMessage.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/verifyMessageSegwit.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/verifyMessageSegwitNative.ts (1 hunks)
  • packages/connect/e2e/__fixtures__/wipeDevice.ts (1 hunks)
  • packages/connect/e2e/globals.d.ts (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/connect/e2e/fixtures/signTransactionZcash.ts
  • packages/connect/e2e/fixtures/signTransaction.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Unit Tests
  • GitHub Check: methods / core_in_popup
  • GitHub Check: methods / web
  • GitHub Check: run_android_e2e_tests
🔇 Additional comments (87)
packages/connect/e2e/__fixtures__/signMessage.ts (4)

248-248: LGTM! Good use of satisfies operator.

The addition of satisfies TestCase assertion enhances type safety while preserving the exact types of the object's properties.


11-16: LGTM! Well-structured test fixture.

The fixture follows a clean and maintainable structure with proper setup configuration.


107-119: Verify if the commented NFKD test case should be enabled.

There's a commented out test case for NFKD message normalization. Consider enabling it if the functionality is supported, or add a comment explaining why it's disabled.

Could you clarify if this test case should be enabled or if there are known issues with NFKD message normalization?


16-247: LGTM! Comprehensive test coverage.

The test suite provides excellent coverage across:

  • Different address types (p2pkh, p2sh, bech32)
  • Both mainnet and testnet networks
  • Various message formats and lengths
  • Legacy version compatibility
packages/connect/e2e/__fixtures__/tezosSignTransaction.ts (2)

172-172: LGTM! Type assertion enhances type safety.

The addition of satisfies TestCase type assertion improves type checking while maintaining the exact type of the object's properties. This change aligns with the PR objectives and TypeScript best practices.


9-172: Verify TestCase type compatibility.

Let's verify that the object structure matches the TestCase type definition.

✅ Verification successful

TestCase type compatibility verified.

The exported object in packages/connect/e2e/__fixtures__/tezosSignTransaction.ts correctly includes the required properties—method (a string), setup (with an optional mnemonic field), and tests (an array of fixture objects). The use of the .map(fixture => ({ ...fixture, legacyResults })) transformation adds an extra property to each fixture, which aligns with how similar fixtures are structured in the repository, and is acceptable given the defined TestCase type.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find and display the TestCase type definition to verify compatibility

# Search for TestCase type definition
ast-grep --pattern 'type TestCase = {
  $$$
}'

# Search for any other files using TestCase to understand the expected structure
rg -l "TestCase" --type ts

Length of output: 5027

packages/connect/e2e/__fixtures__/wipeDevice.ts (1)

1-15: LGTM! Type assertion correctly applied.

The exported object structure matches the TestCase type, and the type assertion is correctly applied.

packages/connect/e2e/__fixtures__/applyFlags.ts (1)

1-17: LGTM! Type assertion correctly applied.

The exported object structure matches the TestCase type, and the type assertion is correctly applied.

packages/connect/e2e/__fixtures__/changeLanguage.ts (1)

1-18: Verify version ranges in skip condition.

The test case includes a skip condition for versions '1' and '<2.7.0'. Please verify that these version ranges are still valid and up-to-date.

✅ Verification successful

Version Skip Conditions in changeLanguage.ts Verified

The skip condition in packages/connect/e2e/__fixtures__/changeLanguage.ts uses ['1', '<2.7.0'], which is consistent with the version range syntax used in other test fixtures in this suite. There’s no evidence from our grep results or from the package metadata (version "1.0.0") that these ranges are outdated. The ranges remain valid under the current test configuration.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for version ranges in skip conditions across test fixtures

# Search for version ranges in skip conditions
rg -A 2 "skip: \[.*\]" packages/connect/e2e/__fixtures__/

# Check package.json for current version
cat package.json | jq '.version'

Length of output: 11292

packages/connect/e2e/__fixtures__/loadDevice.ts (1)

1-18: Verify setup properties against TestCase type.

The setup includes wiped and mnemonic properties. Please verify that these properties are defined in the TestCase type.

✅ Verification successful

Setup properties are correctly defined in TestCase.
The TestCase type in packages/connect/e2e/globals.d.ts specifies wiped?: boolean; and mnemonic?: string;, which match the properties used in the fixture.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check TestCase type definition for setup properties

# Search for TestCase type definition
rg -A 10 "type TestCase" packages/connect/e2e/

Length of output: 666

packages/connect/e2e/__fixtures__/ethereumVerifyMessage.ts (1)

5-21: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety without widening the type inference, which is the recommended approach for type checking in TypeScript.

packages/connect/e2e/__fixtures__/ethereumGetPublicKey.ts (2)

1-3: Consider adding type definitions for the imported fixtures.

Instead of using @ts-ignore, consider adding type definitions for the imported JSON fixtures. This would provide better type safety and IDE support.


5-23: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety without widening the type inference, which is the recommended approach for type checking in TypeScript.

packages/connect/e2e/__fixtures__/getFirmwareHash.ts (1)

1-27: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety without widening the type inference, which is the recommended approach for type checking in TypeScript.

packages/connect/e2e/__fixtures__/applySettings.ts (1)

1-29: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety without widening the type inference, which is the recommended approach for type checking in TypeScript.

packages/connect/e2e/__fixtures__/nemGetAddress.ts (1)

30-30: LGTM! Type assertion enhances type safety.

The addition of satisfies TestCase ensures the exported object conforms to the expected type structure.

packages/connect/e2e/__fixtures__/binanceGetPublicKey.ts (1)

28-28: LGTM! Type assertion enhances type safety.

The addition of satisfies TestCase ensures the exported object conforms to the expected type structure.

packages/connect/e2e/globals.d.ts (2)

27-31: LGTM! Improved type safety for Fixture setup.

The change replaces the generic any type with a structured object type, making the expected properties explicit while keeping them optional.


39-41: LGTM! Improved type safety for TestCase setup.

The change aligns the TestCase setup structure with Fixture, ensuring consistency across types.

packages/connect/e2e/__fixtures__/stellarGetAddress.ts (1)

42-42: LGTM! Type assertion enhances type safety.

The addition of satisfies TestCase ensures the exported object conforms to the expected type structure.

packages/connect/e2e/__fixtures__/solanaGetAddress.ts (2)

47-47: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact type information of the exported object.


4-5: TODO comment needs to be addressed.

The comment indicates that the proper version for Solana support needs to be set.

Would you like me to help determine the correct version or create an issue to track this task?

packages/connect/e2e/__fixtures__/binanceGetAddress.ts (1)

39-39: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact type information of the exported object. The test cases are well-documented with references to the firmware test files.

packages/connect/e2e/__fixtures__/solanaGetPublicKey.ts (2)

47-47: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact type information of the exported object.


4-5: Duplicate TODO comment needs to be addressed.

This TODO comment about setting the proper version for Solana support appears in multiple files. Consider addressing this in a centralized manner.

Would you like me to help consolidate these TODOs into a single tracking issue?

packages/connect/e2e/__fixtures__/tezosGetAddress.ts (1)

52-52: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact type information of the exported object. The test cases are comprehensive, including both positive and negative scenarios.

packages/connect/e2e/__fixtures__/tezosGetPublicKey.ts (1)

52-52: LGTM! Type assertion correctly added.

The addition of satisfies TestCase type assertion aligns with the PR objective and ensures type safety for the test fixture.

packages/connect/e2e/__fixtures__/rippleGetAddress.ts (1)

51-51: LGTM! Type assertion correctly added.

The addition of satisfies TestCase type assertion aligns with the PR objective and ensures type safety for the test fixture.

packages/connect/e2e/__fixtures__/getAddressSegwit.ts (1)

52-52: LGTM! Type assertion correctly added.

The addition of satisfies TestCase type assertion aligns with the PR objective and ensures type safety for the test fixture.

packages/connect/e2e/__fixtures__/cardanoGetAddressDerivations.ts (1)

41-41: LGTM! Type assertion correctly added.

The addition of satisfies TestCase type assertion aligns with the PR objective and ensures type safety for the test fixture.

packages/connect/e2e/__fixtures__/getPublicKeyBip48.ts (1)

42-42: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while maintaining the inferred types of the object's properties.

packages/connect/e2e/__fixtures__/ethereumSignMessage.ts (1)

48-48: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while maintaining the inferred types of the object's properties.

packages/connect/e2e/__fixtures__/ethereumGetAddress.ts (2)

1-3: Consider using proper JSON module resolution.

Instead of using @ts-ignore, consider adding proper JSON module resolution in your TypeScript configuration.


58-58: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while maintaining the inferred types of the object's properties.

packages/connect/e2e/__fixtures__/getAddressMultisig.ts (1)

66-66: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while maintaining the inferred types of the object's properties.

packages/connect/e2e/__fixtures__/ethereumSignTransactionEip1559.ts (1)

61-61: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the inferred types of the exported object.

packages/connect/e2e/__fixtures__/signTransactionDoge.ts (1)

48-48: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the inferred types of the exported object.

packages/connect/e2e/__fixtures__/getAccountDescriptor.ts (1)

67-67: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the inferred types of the exported object.

packages/connect/e2e/__fixtures__/eosGetPublicKey.ts (1)

69-69: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the inferred types of the exported object.

packages/connect/e2e/__fixtures__/getOwnershipId.ts (1)

70-70: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while maintaining the inferred types of the object's properties.

packages/connect/e2e/__fixtures__/nemSignTransactionOthers.ts (1)

56-56: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the inferred types of the test cases.

packages/connect/e2e/__fixtures__/solanaSignTransaction.ts (2)

43-43: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while maintaining the inferred types of the test cases.


4-4: TODO comment needs to be addressed.

The comment indicates that the proper version for Solana support needs to be set.

Would you like me to help track this TODO by opening a new issue?

packages/connect/e2e/__fixtures__/ethereumSignTypedData.ts (1)

73-73: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the inferred types of the test cases.

packages/connect/e2e/__fixtures__/cardanoGetPublicKey.ts (1)

73-73: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact types of the object's properties.

packages/connect/e2e/__fixtures__/signTransactionPeercoin.ts (1)

67-67: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while maintaining the exact types of the test cases.

packages/connect/e2e/__fixtures__/ethereumSignTransactionEip155.ts (1)

83-83: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the complex structure of the Ethereum test cases.

packages/connect/e2e/__fixtures__/signTransactionPaymentRequest.ts (2)

66-66: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the payment request test structure.


9-11: Note: Experimental features are enabled in setup.

The test case requires experimental features to be enabled, which is correctly configured in the setup.

packages/connect/e2e/__fixtures__/verifyMessageSegwit.ts (1)

79-79: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact types of the object's properties.

packages/connect/e2e/__fixtures__/verifyMessageSegwitNative.ts (1)

79-79: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact types of the object's properties.

packages/connect/e2e/__fixtures__/getPublicKey.ts (1)

87-87: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact types of the object's properties.

packages/connect/e2e/__fixtures__/signTransactionKomodo.ts (1)

79-79: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact types of the object's properties.

packages/connect/e2e/__fixtures__/getAddressMultisigPubkeysOrder.ts (1)

119-119: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact type of the exported object.

packages/connect/e2e/__fixtures__/binanceSignTransaction.ts (1)

103-103: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact type of the exported object.

packages/connect/e2e/__fixtures__/signTransactionMultisigPubkeysOrder.ts (1)

108-108: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact type of the exported object.

packages/connect/e2e/__fixtures__/rippleSignTransaction.ts (1)

96-96: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact type of the exported object.

packages/connect/e2e/__fixtures__/ethereumSignTransaction.ts (1)

128-128: LGTM! Type assertion correctly applied.

The type assertion ensures that the exported object conforms to the TestCase interface, enhancing type safety.

packages/connect/e2e/__fixtures__/getAddress.ts (1)

155-155: LGTM! Type assertion correctly applied.

The type assertion ensures type safety while maintaining comprehensive test coverage across different address types and cryptocurrencies.

packages/connect/e2e/__fixtures__/getOwnershipProof.ts (1)

99-99: LGTM! Type assertion correctly applied.

The type assertion ensures type safety for both single and bundled ownership proof test cases.

packages/connect/e2e/__fixtures__/signTransactionDash.ts (2)

113-113: LGTM! Type assertion correctly applied.

The type assertion ensures type safety for Dash transaction signing test cases.


128-128: Verify TypeScript version compatibility.

Let's verify that the satisfies operator is supported in the project's TypeScript version.

Also applies to: 155-155, 99-99, 113-113

✅ Verification successful

TypeScript satisfies Operator Compatibility

The satisfies operator is supported starting from TypeScript 4.9 (released on November 15, 2022). This operator is safe to use provided that the project is using TypeScript version 4.9 or newer.

  • Action Required: Ensure the project’s TypeScript version is 4.9+.
🏁 Scripts executed

The following scripts were executed for the analysis:

Web query:

When was the satisfies operator added to TypeScript and what version is required?

Length of output: 2520

packages/connect/e2e/__fixtures__/signTransactionBcash.ts (1)

119-119: LGTM! Type assertion correctly applied.

The exported object structure matches the TestCase interface requirements with proper method, setup, and tests properties.

packages/connect/e2e/__fixtures__/verifyMessage.ts (1)

141-141: LGTM! Type assertion correctly applied.

The exported object structure matches the TestCase interface requirements with proper method, setup, and tests properties.

packages/connect/e2e/__fixtures__/getAccountInfo.ts (1)

162-162: LGTM! Type assertion correctly applied.

The exported object structure matches the TestCase interface requirements with proper method, setup, and tests properties.

packages/connect/e2e/__fixtures__/solanaComposeTransaction.ts (2)

97-97: LGTM! Type assertion correctly applied.

The exported object structure matches the TestCase interface requirements with proper method, setup, and tests properties.


97-97: Verify TypeScript version compatibility.

Let's confirm that the satisfies operator is supported in the project's TypeScript version.

Also applies to: 119-119, 141-141, 162-162

✅ Verification successful

TypeScript "satisfies" operator compatibility verified.

The satisfies operator is fully supported starting with TypeScript 4.9 (released November 15, 2022). As long as the project uses TypeScript version 4.9 or later, the syntax (e.g., } satisfies TestCase;) is valid and supported.

  • Confirm that the project’s TypeScript version is 4.9+ in your configuration.
🏁 Scripts executed

The following scripts were executed for the analysis:

Web query:

When was the satisfies operator added to TypeScript and what version introduced it?

Length of output: 3039

packages/connect/e2e/__fixtures__/signTransactionSegwit.ts (1)

122-122: LGTM! Type assertion enhances type safety.

The addition of satisfies TestCase ensures that the exported test cases conform to the expected interface structure.

packages/connect/e2e/__fixtures__/signTransactionBech32.ts (1)

143-143: LGTM! Type assertion enhances type safety.

The addition of satisfies TestCase ensures that the exported test cases conform to the expected interface structure.

packages/connect/e2e/__fixtures__/getFeatures.ts (1)

216-216: LGTM! Type assertion enhances type safety.

The addition of satisfies TestCase ensures that the exported test cases conform to the expected interface structure.

packages/connect/e2e/__fixtures__/nemSignTransactionMultisig.ts (1)

171-171: LGTM! Type assertion enhances type safety.

The addition of satisfies TestCase ensures that the exported test cases conform to the expected interface structure.

packages/connect/e2e/__fixtures__/nemSignTransactionMosaic.ts (1)

169-169: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while maintaining the exact type information of the exported object.

packages/connect/e2e/__fixtures__/signTransactionTaproot.ts (1)

158-158: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact type information of the exported object.

packages/connect/e2e/__fixtures__/signTransactionMultisigChange.ts (1)

170-170: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while maintaining the exact type information of the exported object.

packages/connect/e2e/__fixtures__/nemSignTransactionTransfer.ts (2)

212-212: LGTM! Type assertion correctly applied.

The satisfies TestCase assertion ensures type safety while preserving the exact type information of the exported object.


169-169: Verify TypeScript version compatibility.

The satisfies operator requires TypeScript 4.9 or later. Let's verify the project's TypeScript version:

Also applies to: 158-158, 170-170, 212-212

✅ Verification successful

Verify that the project's TypeScript version supports the satisfies operator.

The output shows TypeScript version 5.5.4 in devDependencies, which is well above the minimum required version (4.9) for using the satisfies operator.

  • The code in packages/connect/e2e/__fixtures__/nemSignTransactionTransfer.ts (and other referenced lines) does not need changes related to the satisfies operator.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check TypeScript version in package.json
jq -r '.dependencies.typescript, .devDependencies.typescript' package.json

Length of output: 87

packages/connect/e2e/__fixtures__/stellarSignTransaction.ts (1)

270-270: LGTM! The type assertion enhances type safety.

The addition of satisfies TestCase ensures that the exported object conforms to the expected test case structure while preserving type inference.

packages/connect/e2e/__fixtures__/signTransactionBgold.ts (1)

210-210: LGTM! The type assertion enhances type safety.

The addition of satisfies TestCase ensures that the exported object conforms to the expected test case structure while preserving type inference.

packages/connect/e2e/__fixtures__/signTransactionDecred.ts (1)

203-203: LGTM! The type assertion enhances type safety.

The addition of satisfies TestCase ensures that the exported object conforms to the expected test case structure while preserving type inference.

packages/connect/e2e/__fixtures__/cardanoGetNativeScriptHash.ts (1)

318-318: LGTM! The type assertion enhances type safety.

The addition of satisfies TestCase ensures that the exported object conforms to the expected test case structure while preserving type inference.

packages/connect/e2e/__fixtures__/signTransactionMultisig.ts (1)

275-275: LGTM! Type assertion is correctly applied.

The exported object structure matches the TestCase type with all required fields properly typed.

packages/connect/e2e/__fixtures__/composeTransaction.ts (1)

478-478: LGTM! Type assertion is correctly applied.

The exported object structure matches the TestCase type with all required fields properly typed.

packages/connect/e2e/__fixtures__/cardanoGetAddress.ts (1)

509-509: LGTM! Type assertion is correctly applied.

The exported object structure matches the TestCase type with all required fields properly typed, including the correct application of legacyResults to all test cases.

packages/connect/e2e/__fixtures__/signTransactionReplace.ts (1)

397-397: LGTM! Type assertion is correctly applied.

The exported object structure matches the TestCase type with all required fields properly typed.

packages/connect/e2e/__fixtures__/cardanoSignTransaction.ts (3)

2912-2912: LGTM! Type assertion enhances type safety.

The addition of satisfies TestCase ensures type safety while preserving the exact types of the test cases.


16-432: LGTM! Well-structured test data organization.

The test data is logically organized into clear sections (inputs, outputs, certificates, etc.) which promotes maintainability and reusability.


458-2911: LGTM! Comprehensive test coverage.

The test suite provides extensive coverage of Cardano transaction scenarios, including:

  • Ordinary and Plutus transactions
  • Various output formats
  • Complex scenarios with multiple inputs/outputs
  • Edge cases and special conditions

Copy link
Contributor

@mroz22 mroz22 left a comment

Choose a reason for hiding this comment

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

looks useful

@martykan martykan merged commit 8c7cdcb into develop Feb 4, 2025
58 checks passed
@martykan martykan deleted the chore/connect-fixtures-types branch February 4, 2025 14:16
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.

Add type for fixtures to E2E tests in connect
2 participants