Repository navigation
Expand file tree
/
Copy pathAuthErrorTests.cpp
More file actions
50 lines (46 loc) · 2.03 KB
/
Copy pathAuthErrorTests.cpp
File metadata and controls
50 lines (46 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
*
* @file AuthErrorTests.cpp
* @author Gaspard Kirira
*
* Copyright 2026, Gaspard Kirira.
* All rights reserved.
* https://github.com/rixcpp/auth
*
* Use of this source code is governed by a MIT license
* that can be found in the License file.
*
* Rix
*
*/
#include <rix/auth/AuthError.hpp>
#include <gtest/gtest.h>
namespace
{
using rixlib::auth::AuthErrorCode;
using rixlib::auth::to_string;
TEST(AuthErrorTests, ToStringUsesStableSnakeCaseForEveryCode)
{
EXPECT_EQ(to_string(AuthErrorCode::None), "none");
EXPECT_EQ(to_string(AuthErrorCode::InvalidInput), "invalid_input");
EXPECT_EQ(to_string(AuthErrorCode::InvalidState), "invalid_state");
EXPECT_EQ(to_string(AuthErrorCode::InvalidEmail), "invalid_email");
EXPECT_EQ(to_string(AuthErrorCode::InvalidPassword), "invalid_password");
EXPECT_EQ(to_string(AuthErrorCode::UserNotFound), "user_not_found");
EXPECT_EQ(to_string(AuthErrorCode::UserAlreadyExists), "user_already_exists");
EXPECT_EQ(to_string(AuthErrorCode::InvalidCredentials), "invalid_credentials");
EXPECT_EQ(to_string(AuthErrorCode::EmailVerificationRequired), "email_verification_required");
EXPECT_EQ(to_string(AuthErrorCode::UserDisabled), "user_disabled");
EXPECT_EQ(to_string(AuthErrorCode::InvalidSession), "invalid_session");
EXPECT_EQ(to_string(AuthErrorCode::SessionExpired), "session_expired");
EXPECT_EQ(to_string(AuthErrorCode::SessionRevoked), "session_revoked");
EXPECT_EQ(to_string(AuthErrorCode::InvalidToken), "invalid_token");
EXPECT_EQ(to_string(AuthErrorCode::TokenExpired), "token_expired");
EXPECT_EQ(to_string(AuthErrorCode::TokenRevoked), "token_revoked");
EXPECT_EQ(to_string(AuthErrorCode::StoreError), "store_error");
EXPECT_EQ(to_string(AuthErrorCode::CryptoError), "crypto_error");
EXPECT_EQ(to_string(AuthErrorCode::ValidationError), "validation_error");
EXPECT_EQ(to_string(AuthErrorCode::ConfigurationError), "configuration_error");
EXPECT_EQ(to_string(AuthErrorCode::Unknown), "unknown");
}
} // namespace