         access.expectedErrorCode = .errorCodeInvalidEmail
         
         let expectation1 = expectation(description: "Invalid email format having no @ and non-empty password")
-        service.login(email: "afdsafsafdsf", password: "kkJDKFj213898pr") { result in
-            switch result {
-            case .fail(let info):
-                switch info {
-                case .invalidEmail : break
-                default : XCTFail("Error 'info' is not of type '.invalidEmail'")
-                }
-                
-            default:
-                XCTFail("'result' is not of type '.fail'")
+        service.login(email: "abcde12334qwert", password: "123456789abcde") { result in
+            switch result {
+            case .fail(let info) where info == .invalidEmail:
+                break
+                
+            default:
+                XCTFail()
             }
             expectation1.fulfill()
         }
         
         let expectation2 = expectation(description: "Invalid email format having @ at the end")
-        service.login(email: "123adkl213@", password: "kkJDKFj213898pr") { result in
-            switch result {
-            case .fail(let info):
-                switch info {
-                case .invalidEmail : break
-                default : XCTFail("Error 'info' is not of type '.invalidEmail'")
-                }
-                
-            default:
-                XCTFail("'result' is not of type '.fail'")
+        service.login(email: "you@", password: "123456789abcde") { result in
+            switch result {
+            case .fail(let info) where info == .invalidEmail:
+                break
+                
+            default:
+                XCTFail()
             }
             expectation2.fulfill()
         }
         
         let expectation3 = expectation(description: "Invalid email format having @ at the beginning")
-        service.login(email: "@123jkjsdf", password: "kkJDKFj213898pr") { result in
-            switch result {
-            case .fail(let info):
-                switch info {
-                case .invalidEmail : break
-                default : XCTFail("Error 'info' is not of type '.invalidEmail'")
-                }
-                
-            default:
-                XCTFail("'result' is not of type '.fail'")
+        service.login(email: "@you.com", password: "123456789abcde") { result in
+            switch result {
+            case .fail(let info) where info == .invalidEmail:
+                break
+                
+            default:
+                XCTFail()
             }
             expectation3.fulfill()
         }
         
         let expectation4 = expectation(description: "Invalid email format having @ at the end and beginning")
-        service.login(email: "@123jkjsdf@", password: "kkJDKFj213898pr") { result in
-            switch result {
-            case .fail(let info):
-                switch info {
-                case .invalidEmail : break
-                default : XCTFail("Error 'info' is not of type '.invalidEmail'")
-                }
-                
-            default:
-                XCTFail("'result' is not of type '.fail'")
+        service.login(email: "@you@", password: "123456789abcde") { result in
+            switch result {
+            case .fail(let info) where info == .invalidEmail:
+                break
+                
+            default:
+                XCTFail()
             }
             expectation4.fulfill()
         }
         
         let expectation5 = expectation(description: "Invalid email format with all @")
-        service.login(email: "@@@@@@", password: "kkJDKFj213898pr") { result in
-            switch result {
-            case .fail(let info):
-                switch info {
-                case .invalidEmail : break
-                default : XCTFail("Error 'info' is not of type '.invalidEmail'")
-                }
-                
-            default:
-                XCTFail("'result' is not of type '.fail'")
+        service.login(email: "@@@@@@", password: "123456789abcde") { result in
+            switch result {
+            case .fail(let info) where info == .invalidEmail:
+                break
+                
+            default:
+                XCTFail()
             }
             expectation5.fulfill()
         }
         
         let expectation6 = expectation(description: "Invalid email format with two @ in between")
-        service.login(email: "asdfadsf@kjksadjf@jdskf", password: "kkJDKFj213898pr") { result in
-            switch result {
-            case .fail(let info):
-                switch info {
-                case .invalidEmail : break
-                default : XCTFail("Error 'info' is not of type '.invalidEmail'")
-                }
-                
-            default:
-                XCTFail("'result' is not of type '.fail'")
+        service.login(email: "you@me@we", password: "123456789abcde") { result in
+            switch result {
+            case .fail(let info) where info == .invalidEmail:
+                break
+                
+            default:
+                XCTFail()
             }
             expectation6.fulfill()
         }

        let expectation1 = expectation(description: "Empty email and password")
        service.login(email: "", password: "") { result in
            switch result {
            case .fail(let info):
                switch info {
                case .wrongPassword : break
                default : XCTFail("Error 'info' is not of type '.wrongPassword'")
                }
                
            default:
                XCTFail("'result' is not of type '.fail'")
            }
            expectation1.fulfill()
        }

        service.login(email: "me@me.com", password: "123456789") { result in
            switch result {
            case .success(let info):
                XCTAssertNotNil(info.accessToken)
                XCTAssertFalse(info.accessToken!.isEmpty)
                XCTAssertNotNil(info.user)
                XCTAssertFalse(info.user!.id.isEmpty)
                
            default:
                XCTFail()
            }
            expectation1.fulfill()
        }
