mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-2649 Protocol | Enhancement | 0.35.0-rc5 (#1372)
This commit is contained in:
parent
b2dd0265b6
commit
26ae59d803
21 changed files with 143 additions and 146 deletions
|
@ -7,18 +7,13 @@ import com.anytypeio.anytype.domain.auth.model.Wallet
|
|||
|
||||
fun AccountEntity.toDomain(): Account {
|
||||
return Account(
|
||||
id = id,
|
||||
name = name,
|
||||
color = color,
|
||||
avatar = null
|
||||
id = id
|
||||
)
|
||||
}
|
||||
|
||||
fun Account.toEntity(): AccountEntity {
|
||||
return AccountEntity(
|
||||
id = id,
|
||||
name = name,
|
||||
color = color
|
||||
id = id
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.anytypeio.anytype.data.auth.model
|
||||
|
||||
data class AccountEntity(
|
||||
val id: String,
|
||||
val name: String,
|
||||
val color: String?
|
||||
val id: String
|
||||
)
|
|
@ -191,9 +191,7 @@ class AuthDataRepositoryTest {
|
|||
fun `should call only cache in order to get current account`() = runBlocking {
|
||||
|
||||
val account = AccountEntity(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
color = null
|
||||
id = MockDataFactory.randomUuid()
|
||||
)
|
||||
|
||||
authCache.stub {
|
||||
|
@ -275,9 +273,7 @@ class AuthDataRepositoryTest {
|
|||
fun `should call only cache in order to get available accounts`() = runBlocking {
|
||||
|
||||
val account = AccountEntity(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
color = null
|
||||
id = MockDataFactory.randomUuid()
|
||||
)
|
||||
|
||||
val accounts = listOf(account)
|
||||
|
|
|
@ -27,16 +27,11 @@ class MapperExtensionTest {
|
|||
fun `should map correctly account from domain to data layer`() {
|
||||
|
||||
val account = Account(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
color = MockDataFactory.randomString(),
|
||||
avatar = MockDataFactory.randomString()
|
||||
id = MockDataFactory.randomUuid()
|
||||
)
|
||||
|
||||
account.toEntity().let { result ->
|
||||
assertTrue { result.id == account.id }
|
||||
assertTrue { result.name == account.name }
|
||||
assertTrue { result.color == account.color }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,16 +39,11 @@ class MapperExtensionTest {
|
|||
fun `should map correctly account from data to domain layer`() {
|
||||
|
||||
val account = AccountEntity(
|
||||
id = MockDataFactory.randomUuid(),
|
||||
name = MockDataFactory.randomString(),
|
||||
color = MockDataFactory.randomString()
|
||||
id = MockDataFactory.randomUuid()
|
||||
)
|
||||
|
||||
account.toDomain().let { result ->
|
||||
assertTrue { result.id == account.id }
|
||||
assertTrue { result.name == account.name }
|
||||
assertTrue { result.avatar == null }
|
||||
assertTrue { result.color == account.color }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue