Skip to content

test: Use kotest and mockk to mock RPC request#641

Merged
quake merged 8 commits into
nervosnetwork:masterfrom
liuck8080:kotest
Jul 20, 2023
Merged

test: Use kotest and mockk to mock RPC request#641
quake merged 8 commits into
nervosnetwork:masterfrom
liuck8080:kotest

Conversation

@liuck8080
Copy link
Copy Markdown
Contributor

@liuck8080 liuck8080 commented May 8, 2023

What does this PR do?

  • Mock OkHttpClient to test light-client, so it does not need a light-client server running.

Why kotest and mockk

  • OkHttpClient referred in RpcService was written in kotlin.
  • kotlin can operate java code, so a kotlin test framework can server the purpose.
  • mockk support kotlin very well.
  • The famous test framework Spock can not mock class OkHttpClient, and mockk can do it very well.

Note

@liuck8080 liuck8080 requested a review from quake May 8, 2023 01:42
@liuck8080 liuck8080 marked this pull request as ready for review May 15, 2023 00:08
@quake quake merged commit 25dde25 into nervosnetwork:master Jul 20, 2023
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.

3 participants