Skip to content

Commit

Permalink
Fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
Кирилл committed Nov 20, 2023
1 parent de6050d commit 9110866
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface ErrorProcessor {

@Component
open class ErrorCorrector(
private val processors: List<ErrorProcessor>
private val processors: List<ErrorProcessor>,
) {

fun correctError(result: NativeCall.CallResult): NativeCall.CallError {
Expand All @@ -23,7 +23,6 @@ open class ErrorCorrector(
?.errorProcess(result.error!!)
?: result.error!!
}

}

@Component
Expand All @@ -38,8 +37,7 @@ class NethermindEthCallRevertedErrorProcessor : ErrorProcessor {
error.message,
error.upstreamError,
error.data?.removePrefix("Reverted "),
error.upstreamId
error.upstreamId,
)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ class ErrorProcessingTest {

val fixedError = corrector.correctError(result)


assertEquals(
NativeCall.CallError(3, error.message, error.upstreamError, "0x0111", error.upstreamId),
fixedError
fixedError,
)
}

Expand All @@ -34,10 +33,9 @@ class ErrorProcessingTest {

val fixedError = corrector.correctError(result)


assertEquals(
NativeCall.CallError(55, error.message, error.upstreamError, "Reverted 0x0111", error.upstreamId),
fixedError
fixedError,
)
}

Expand Down Expand Up @@ -67,7 +65,7 @@ class ErrorProcessingTest {
"reverted",
JsonRpcError(1, "errMessage", null),
"Reverted 0x0111",
"upId"
"upId",
),
null,
NativeCall.ValidCallContext(
Expand All @@ -78,7 +76,7 @@ class ErrorProcessingTest {
mock<CallQuorum>(),
NativeCall.ParsedCallDetails(method, emptyList()),
"req",
1
)
1,
),
)
}

0 comments on commit 9110866

Please sign in to comment.