-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix kt manifest summary. Improve kt coverage (#253)
* Fix kt manifest summary. Improve kt coverage * Fix version
- Loading branch information
1 parent
15824be
commit 4694350
Showing
10 changed files
with
123 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
jvm/sargon-android/src/main/java/com/radixdlt/sargon/samples/NetworkMethodSample.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.radixdlt.sargon.samples | ||
|
||
import com.radixdlt.sargon.NetworkMethod | ||
import com.radixdlt.sargon.annotation.UsesSampleValues | ||
import com.radixdlt.sargon.newNetworkMethodSample | ||
import com.radixdlt.sargon.newNetworkMethodSampleOther | ||
|
||
@UsesSampleValues | ||
val NetworkMethod.Companion.sample: Sample<NetworkMethod> | ||
get() = object : Sample<NetworkMethod> { | ||
|
||
override fun invoke(): NetworkMethod = newNetworkMethodSample() | ||
|
||
override fun other(): NetworkMethod = newNetworkMethodSampleOther() | ||
} |
29 changes: 29 additions & 0 deletions
29
jvm/sargon-android/src/test/java/com/radixdlt/sargon/NetworkMethodTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.radixdlt.sargon | ||
|
||
import com.radixdlt.sargon.extensions.toHttpMethod | ||
import com.radixdlt.sargon.samples.Sample | ||
import com.radixdlt.sargon.samples.sample | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Test | ||
|
||
class NetworkMethodTest: SampleTestable<NetworkMethod> { | ||
|
||
@Test | ||
fun test() { | ||
assertEquals( | ||
"POST", | ||
NetworkMethod.POST.toHttpMethod() | ||
) | ||
assertEquals( | ||
"GET", | ||
NetworkMethod.GET.toHttpMethod() | ||
) | ||
assertEquals( | ||
"HEAD", | ||
NetworkMethod.HEAD.toHttpMethod() | ||
) | ||
} | ||
|
||
override val samples: List<Sample<NetworkMethod>> | ||
get() = listOf(NetworkMethod.sample) | ||
} |
22 changes: 22 additions & 0 deletions
22
jvm/sargon-android/src/test/java/com/radixdlt/sargon/SubintentHashTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.radixdlt.sargon | ||
|
||
import com.radixdlt.sargon.extensions.formatted | ||
import com.radixdlt.sargon.extensions.init | ||
import com.radixdlt.sargon.samples.Sample | ||
import com.radixdlt.sargon.samples.sample | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Test | ||
|
||
class SubintentHashTest : SampleTestable<SubintentHash> { | ||
|
||
override val samples: List<Sample<SubintentHash>> | ||
get() = listOf(SubintentHash.sample) | ||
|
||
@Test | ||
fun test() { | ||
val sut = SubintentHash.init("subtxid_rdx1frcm6zzyfd08z0deu9x24sh64eccxeux4j2dv3dsqeuh9qsz4y6sy6hgte") | ||
val actual = sut.formatted() | ||
|
||
assertEquals("subt...y6hgte", actual) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
jvm/sargon-android/src/test/java/com/radixdlt/sargon/SubintentManifestTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.radixdlt.sargon | ||
|
||
import com.radixdlt.sargon.extensions.blobs | ||
import com.radixdlt.sargon.extensions.init | ||
import com.radixdlt.sargon.extensions.involvedPoolAddresses | ||
import com.radixdlt.sargon.extensions.involvedResourceAddresses | ||
import com.radixdlt.sargon.extensions.manifestString | ||
import com.radixdlt.sargon.samples.Sample | ||
import com.radixdlt.sargon.samples.sample | ||
import com.radixdlt.sargon.samples.sampleMainnet | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Assertions.assertTrue | ||
import org.junit.jupiter.api.Test | ||
|
||
class SubintentManifestTest : SampleTestable<SubintentManifest> { | ||
|
||
override val samples: List<Sample<SubintentManifest>> | ||
get() = listOf(SubintentManifest.sample) | ||
|
||
@Test | ||
fun test() { | ||
val manifest = SubintentManifest.sample() | ||
|
||
assertTrue(manifest.manifestString.contains("CALL_METHOD")) | ||
assertEquals(Blobs.init(emptyList()), manifest.blobs) | ||
assertEquals(emptyList<PoolAddress>(), manifest.involvedPoolAddresses) | ||
assertEquals(listOf(ResourceAddress.sampleMainnet()), manifest.involvedResourceAddresses) | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
jvm/sargon-android/src/test/java/com/radixdlt/sargon/SubintentTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.radixdlt.sargon | ||
|
||
import com.radixdlt.sargon.extensions.hash | ||
import com.radixdlt.sargon.extensions.init | ||
import com.radixdlt.sargon.samples.Sample | ||
import com.radixdlt.sargon.samples.sample | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Test | ||
|
||
class SubintentTest : SampleTestable<Subintent> { | ||
|
||
override val samples: List<Sample<Subintent>> | ||
get() = listOf(Subintent.sample) | ||
|
||
@Test | ||
fun test() { | ||
assertEquals( | ||
SubintentHash.init("subtxid_rdx1xput628m2l7jjweefd70gnq3t3a5x2gjeljduwm7vwly94s8ullql92sa0"), | ||
Subintent.sample().hash() | ||
) | ||
} | ||
} |
5 changes: 1 addition & 4 deletions
5
jvm/sargon-android/src/test/java/com/radixdlt/sargon/TransactionManifestV2Test.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters