Skip to content

Commit

Permalink
Merge pull request #641 from liuck8080/kotest
Browse files Browse the repository at this point in the history
test: Use kotest and mockk to mock RPC request
  • Loading branch information
quake authored Jul 20, 2023
2 parents 269ae95 + 13d3e05 commit 25dde25
Show file tree
Hide file tree
Showing 15 changed files with 364 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ hs_err_pid*
/build
/out
*/build/
*/bin/
*/out/
*/build**/

Expand Down
6 changes: 6 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ buildscript {
ext.slf4jVersion = '2.0.0'
ext.guavaVersion = '31.1-jre'
ext.junitVersion = '5.9.0'
ext.kotestVersion = '5.6.1'
ext.kotlinVersion = "1.8.21"
ext.mockkVersion = "1.13.5"

repositories {
mavenCentral()
Expand Down
11 changes: 11 additions & 0 deletions light-client/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version "$kotlinVersion"
}

group 'org.nervos.ckb'
Expand All @@ -18,8 +19,18 @@ dependencies {

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'

testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
testImplementation "io.mockk:mockk:${mockkVersion}"
testImplementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")

testImplementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
}

test {
useJUnitPlatform()
}
//kotlin {
// jvmToolchain(11)
//}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.nervos.lightclient.type.*;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
import org.nervos.ckb.type.Block;
Expand All @@ -19,6 +20,7 @@
import java.util.List;

@DisabledIfEnvironmentVariable(named = "CI", matches = "true")
@Disabled
class DefaultLightClientApiTest {
public LightClientApi api = new DefaultLightClientApi("http://localhost:9000");
// ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsq2qf8keemy2p5uu0g0gn8cd4ju23s5269qk8rg4r
Expand Down
Loading

0 comments on commit 25dde25

Please sign in to comment.