-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OutgoingServerSettingsStateMapperKtTest : Updated Tests related to nu…
…ll server settings so state obtain server name as emailDomain dot prefix. IncomingServerSettingsStateMapperKtTest : replaced emailAddress field in accountState from hardcoded string to local variable in a test.
- Loading branch information
1 parent
1341912
commit 4bd8475
Showing
2 changed files
with
15 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,11 +18,12 @@ import org.junit.Test | |
|
||
class IncomingServerSettingsStateMapperKtTest { | ||
|
||
@Suppress("MaxLineLength") | ||
@Test | ||
fun `should map to state with email as username and emailDomain With dot prefix as server name when server settings are null`() { | ||
val email = "[email protected]" | ||
val accountState = AccountState( | ||
emailAddress = "[email protected]", | ||
emailAddress = email, | ||
incomingServerSettings = null, | ||
) | ||
|
||
|
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ import app.k9mail.feature.account.common.domain.entity.ConnectionSecurity | |
import app.k9mail.feature.account.common.domain.entity.MailConnectionSecurity | ||
import app.k9mail.feature.account.common.domain.input.NumberInputField | ||
import app.k9mail.feature.account.common.domain.input.StringInputField | ||
import app.k9mail.feature.account.server.settings.ui.common.toInvalidEmailDomain | ||
import app.k9mail.feature.account.server.settings.ui.outgoing.OutgoingServerSettingsContract.State | ||
import assertk.assertThat | ||
import assertk.assertions.isEqualTo | ||
|
@@ -15,26 +16,31 @@ import org.junit.Test | |
|
||
class OutgoingServerSettingsStateMapperKtTest { | ||
|
||
@Suppress("MaxLineLength") | ||
@Test | ||
fun `should map to state with email as username when server settings are null`() { | ||
fun `should map to state with email as username and emailDomain With dot prefix as server name when server settings are null`() { | ||
val email = "[email protected]" | ||
val accountState = AccountState( | ||
emailAddress = "[email protected]", | ||
emailAddress = email, | ||
outgoingServerSettings = null, | ||
) | ||
|
||
val result = accountState.toOutgoingServerSettingsState() | ||
|
||
assertThat(result).isEqualTo( | ||
State( | ||
username = StringInputField(value = "[email protected]"), | ||
username = StringInputField(value = email), | ||
server = StringInputField(value = email.toInvalidEmailDomain()), | ||
), | ||
) | ||
} | ||
|
||
@Suppress("MaxLineLength") | ||
@Test | ||
fun `should map to state with password from incomingServerSettings when outgoingServerSettings is null`() { | ||
fun `should map to state with password from incomingServerSettings and emailDomain With dot prefix as server name when outgoingServerSettings is null`() { | ||
val email = "[email protected]" | ||
val accountState = AccountState( | ||
emailAddress = "[email protected]", | ||
emailAddress = email, | ||
incomingServerSettings = IMAP_SERVER_SETTINGS, | ||
outgoingServerSettings = null, | ||
) | ||
|
@@ -43,8 +49,9 @@ class OutgoingServerSettingsStateMapperKtTest { | |
|
||
assertThat(result).isEqualTo( | ||
State( | ||
username = StringInputField(value = "[email protected]"), | ||
username = StringInputField(value = email), | ||
password = StringInputField(value = INCOMING_SERVER_PASSWORD), | ||
server = StringInputField(value = email.toInvalidEmailDomain()), | ||
), | ||
) | ||
} | ||
|