-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1490 from WalletConnect/develop
BOM_1.35.1
- Loading branch information
Showing
15 changed files
with
162 additions
and
32 deletions.
There are no files selected for viewing
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
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
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
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
7 changes: 6 additions & 1 deletion
7
...l/sign/src/main/kotlin/com/walletconnect/sign/json_rpc/domain/DeleteRequestByIdUseCase.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 |
---|---|---|
@@ -1,13 +1,18 @@ | ||
package com.walletconnect.sign.json_rpc.domain | ||
|
||
import com.walletconnect.android.internal.common.storage.rpc.JsonRpcHistory | ||
import com.walletconnect.android.internal.common.storage.verify.VerifyContextStorageRepository | ||
import kotlinx.coroutines.supervisorScope | ||
|
||
internal class DeleteRequestByIdUseCase(private val jsonRpcHistory: JsonRpcHistory) { | ||
internal class DeleteRequestByIdUseCase( | ||
private val jsonRpcHistory: JsonRpcHistory, | ||
private val verifyContextStorageRepository: VerifyContextStorageRepository | ||
) { | ||
|
||
suspend operator fun invoke(id: Long) { | ||
supervisorScope { | ||
jsonRpcHistory.deleteRecordById(id) | ||
verifyContextStorageRepository.delete(id) | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
protocol/sign/src/test/kotlin/com/walletconnect/sign/DeleteRequestByIdUseCaseTest.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,35 @@ | ||
package com.walletconnect.sign | ||
|
||
import com.walletconnect.android.internal.common.storage.rpc.JsonRpcHistory | ||
import com.walletconnect.android.internal.common.storage.verify.VerifyContextStorageRepository | ||
import com.walletconnect.sign.json_rpc.domain.DeleteRequestByIdUseCase | ||
import io.mockk.coVerify | ||
import io.mockk.mockk | ||
import io.mockk.slot | ||
import kotlinx.coroutines.runBlocking | ||
import org.junit.Before | ||
import org.junit.Test | ||
|
||
class DeleteRequestByIdUseCaseTest { | ||
private lateinit var jsonRpcHistory: JsonRpcHistory | ||
private lateinit var verifyContextStorageRepository: VerifyContextStorageRepository | ||
private lateinit var deleteRequestByIdUseCase: DeleteRequestByIdUseCase | ||
|
||
@Before | ||
fun setup() { | ||
jsonRpcHistory = mockk(relaxed = true) | ||
verifyContextStorageRepository = mockk(relaxed = true) | ||
deleteRequestByIdUseCase = DeleteRequestByIdUseCase(jsonRpcHistory, verifyContextStorageRepository) | ||
} | ||
|
||
@Test | ||
fun `invoke should delete record by id from jsonRpcHistory and verifyContextStorageRepository`() = runBlocking { | ||
val idSlot = slot<Long>() | ||
val id = 123L | ||
|
||
deleteRequestByIdUseCase.invoke(id) | ||
|
||
coVerify(exactly = 1) { jsonRpcHistory.deleteRecordById(capture(idSlot)) } | ||
coVerify(exactly = 1) { verifyContextStorageRepository.delete(capture(idSlot)) } | ||
} | ||
} |
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