-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: improve naming of validator
- Loading branch information
1 parent
9d5298e
commit 43c537a
Showing
4 changed files
with
14 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,15 +9,15 @@ import io.mockk.verify | |
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.Test | ||
|
||
class EmailOrSSOCodeValidatorTest { | ||
class ValidateEmailOrSSOCodeUseCaseTest { | ||
|
||
@Test | ||
fun `given an input, when is an email and valid, then return true`() { | ||
val (arrangement, sut) = Arrangement() | ||
.withValidateEmailUseCaseReturning(true) | ||
.arrange() | ||
|
||
val result = sut.validate("[email protected]") | ||
val result = sut.invoke("[email protected]") | ||
|
||
verify { arrangement.validateEmailUseCase(any()) } | ||
verify(exactly = 0) { arrangement.validateSSOCodeUseCase(any()) } | ||
|
@@ -30,7 +30,7 @@ class EmailOrSSOCodeValidatorTest { | |
.withValidateEmailUseCaseReturning(false) | ||
.arrange() | ||
|
||
val result = sut.validate("user@") | ||
val result = sut.invoke("user@") | ||
|
||
verify { arrangement.validateEmailUseCase(any()) } | ||
verify(exactly = 0) { arrangement.validateSSOCodeUseCase(any()) } | ||
|
@@ -44,7 +44,7 @@ class EmailOrSSOCodeValidatorTest { | |
.withValidateSSOCodeUseCaseReturning(ValidateSSOCodeResult.Valid(code)) | ||
.arrange() | ||
|
||
val result = sut.validate("wire-$code") | ||
val result = sut.invoke("wire-$code") | ||
|
||
verify { arrangement.validateSSOCodeUseCase(any()) } | ||
verify(exactly = 0) { arrangement.validateEmailUseCase(any()) } | ||
|
@@ -58,7 +58,7 @@ class EmailOrSSOCodeValidatorTest { | |
.withValidateSSOCodeUseCaseReturning(ValidateSSOCodeResult.Invalid) | ||
.arrange() | ||
|
||
val result = sut.validate("wire-$code") | ||
val result = sut.invoke("wire-$code") | ||
|
||
verify { arrangement.validateSSOCodeUseCase(any()) } | ||
verify(exactly = 0) { arrangement.validateEmailUseCase(any()) } | ||
|
@@ -72,7 +72,7 @@ class EmailOrSSOCodeValidatorTest { | |
.withValidateEmailUseCaseReturning(false) | ||
.arrange() | ||
|
||
val result = sut.validate("nothing-valid") | ||
val result = sut.invoke("nothing-valid") | ||
|
||
verify(exactly = 1) { arrangement.validateEmailUseCase(any()) } | ||
verify(exactly = 0) { arrangement.validateSSOCodeUseCase(any()) } | ||
|
@@ -92,7 +92,7 @@ class EmailOrSSOCodeValidatorTest { | |
every { validateSSOCodeUseCase(any()) } returns result | ||
} | ||
|
||
fun arrange() = this to EmailOrSSOCodeValidator(validateEmailUseCase, validateSSOCodeUseCase) | ||
fun arrange() = this to ValidateEmailOrSSOCodeUseCase(validateEmailUseCase, validateSSOCodeUseCase) | ||
} | ||
|
||
} |