Answer the question
In order to leave comments, you need to log in
How to write unit tests for the login verification function (swift)?
I have a login validation function, what should unit tests look like for it?
func isAllowed(withLogin login: String?) -> Bool {
let regex: String = "^((?!([0-9/./-]))[a-zA-Z0-9/@/./-]{3,32})$"
let predicate = NSPredicate(format: "SELF MATCHES %@", regex)
return predicate.evaluate(with: login)
}
Answer the question
In order to leave comments, you need to log in
Here is an example with a set of valid/invalid emails: https://codefool.tumblr.com/post/15288874550/list-...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question