Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Add Kotlin script tests #32

Merged
merged 15 commits into from
Feb 7, 2024
Merged

Add Kotlin script tests #32

merged 15 commits into from
Feb 7, 2024

Conversation

micbakos-rdx
Copy link
Contributor

@micbakos-rdx micbakos-rdx commented Feb 7, 2024

Tests written in Kotlin script that validate the usage of this library in the Kotlin world.

Some changes were needed in order to be able to compile the library in kotlin:

  1. Renaming some enums to resolve such errors

    .../radix_wallet_kit.kt:4874:17: error: type mismatch: inferred type is uniffi.radix_wallet_kit.AccountPath but 
    uniffi.radix_wallet_kit.Cap26Path.AccountPath was expected
                FfiConverterTypeAccountPath.read(buf),
    

    CAP26Path enum values to:
    * GetID
    * Account
    * Identity

    DepositorAddress enum values to:
    * Resource
    * NFGlobalID

  2. Uniffi toml configuration:

    • Used the correct imports for java.time.*
    • Renamed the package_name = "radix.wallet.kit"
  3. See the updated Readme regarding what it needs to build and run the tests

    • In order for KTS scripts to run the user needs to install Kotlin with
      brew install kotlin
      
    • Download the required JNA library
      wget https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.13.0/jna-5.13.0.jar
      
    • And include it in the classpath when running the tests
      JAVA_OPTS="-Xmx8g" CLASSPATH="path-to-jna/jna-5.13.0.jar" cargo nextest run --package profile --test uniffi && cargo nextest run
      

Pending

  • Some assertions are commented out. They have to do with equality check that will be resolved by this PR. All such assertions have a TODO comment
    // TODO will change these when HexCoded32Bytes is represented with a list of bytes
  • URL, UDID, OffsetDateTime classes are not yet verified through tests. This will come in a later PR.

@Sajjon Sajjon merged commit 3f59042 into Sajjon:develop Feb 7, 2024
@micbakos-rdx micbakos-rdx deleted the kotlin-tests branch February 7, 2024 11:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants