-
Notifications
You must be signed in to change notification settings - Fork 16
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 #555 from jorgeblacio/release_0_21_17
Various bug fixes for new release.
- Loading branch information
Showing
10 changed files
with
50 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,47 +15,61 @@ class AccountDataValidatorTest { | |
fun `validateUsername should return valid if receives a valid username`() { | ||
val myUsername = "tester" | ||
AccountDataValidator.validateUsername(myUsername) `should equal` FormData.Valid("tester") | ||
AccountDataValidator.validateUsernameOnly(myUsername) `should equal` FormData.Valid("tester") | ||
} | ||
|
||
@Test | ||
fun `validateUsername should return valid if receives less than 3 characters`() { | ||
val myUsername = "t" | ||
AccountDataValidator.validateUsername(myUsername) `should be instance of` FormData.Error::class.java | ||
AccountDataValidator.validateUsernameOnly(myUsername) `should be instance of` FormData.Error::class.java | ||
} | ||
|
||
@Test | ||
fun `validateUsername should return error if receives spaces in the middle of the username`() { | ||
val myUsername = "anew tester" | ||
AccountDataValidator.validateUsername(myUsername) `should be instance of` FormData.Error::class.java | ||
AccountDataValidator.validateUsernameOnly(myUsername) `should be instance of` FormData.Error::class.java | ||
} | ||
|
||
@Test | ||
fun `validateUsername should return error if receives invalid characters in username`() { | ||
val myUsername = "test#" | ||
AccountDataValidator.validateUsername(myUsername) `should be instance of` FormData.Error::class.java | ||
AccountDataValidator.validateUsernameOnly(myUsername) `should be instance of` FormData.Error::class.java | ||
} | ||
|
||
@Test | ||
fun `validateUsername should return error if username starts with dot`() { | ||
val myUsername = ".tester" | ||
AccountDataValidator.validateUsername(myUsername) `should be instance of` FormData.Error::class.java | ||
AccountDataValidator.validateUsernameOnly(myUsername) `should be instance of` FormData.Error::class.java | ||
} | ||
|
||
@Test | ||
fun `validateUsername should return valid if receives dots, dashes or lowdashes in username`() { | ||
val myUsername = "test.t_est-er05" | ||
AccountDataValidator.validateUsername(myUsername) `should be instance of` FormData.Valid::class.java | ||
AccountDataValidator.validateUsernameOnly(myUsername) `should be instance of` FormData.Valid::class.java | ||
} | ||
|
||
@Test | ||
fun `validateEmailAddress should return valid if receives a valid address`() { | ||
val address = "[email protected]" | ||
AccountDataValidator.validateEmailAddress(address) `should equal` FormData.Valid(address) | ||
AccountDataValidator.validateUsername(address) `should equal` FormData.Valid(address) | ||
} | ||
|
||
@Test | ||
fun `validateUsernameOnly should return error if receives an email address`() { | ||
val address = "[email protected]" | ||
AccountDataValidator.validateUsernameOnly(address) `should be instance of` FormData.Error::class.java | ||
} | ||
|
||
@Test | ||
fun `validateEmailAddress should return error if receives angular brackets and spaces`() { | ||
val address = "Some User <[email protected]>" | ||
AccountDataValidator.validateEmailAddress(address) `should be instance of` FormData.Error::class.java | ||
AccountDataValidator.validateUsername(address) `should be instance of` FormData.Error::class.java | ||
} | ||
} |