diff options
Diffstat (limited to 'backend/fortee')
| -rw-r--r-- | backend/fortee/fortee_test.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/backend/fortee/fortee_test.go b/backend/fortee/fortee_test.go new file mode 100644 index 0000000..90ae625 --- /dev/null +++ b/backend/fortee/fortee_test.go @@ -0,0 +1,44 @@ +package fortee + +import ( + "context" + "net/http" + "testing" +) + +func TestAddAcceptHeader(t *testing.T) { + req, err := http.NewRequest(http.MethodGet, "https://example.com", nil) + if err != nil { + t.Fatalf("failed to create request: %v", err) + } + + if err := addAcceptHeader(context.Background(), req); err != nil { + t.Fatalf("unexpected error: %v", err) + } + + got := req.Header.Get("Accept") + if got != "application/json" { + t.Errorf("expected Accept header 'application/json', got %q", got) + } +} + +func TestEndpoint(t *testing.T) { + if Endpoint != "https://fortee.jp" { + t.Errorf("expected endpoint 'https://fortee.jp', got %q", Endpoint) + } +} + +func TestErrorValues(t *testing.T) { + if ErrLoginFailed == nil { + t.Error("ErrLoginFailed should not be nil") + } + if ErrUserNotFound == nil { + t.Error("ErrUserNotFound should not be nil") + } + if ErrLoginFailed.Error() != "fortee login failed" { + t.Errorf("unexpected error message: %q", ErrLoginFailed.Error()) + } + if ErrUserNotFound.Error() != "fortee user not found" { + t.Errorf("unexpected error message: %q", ErrUserNotFound.Error()) + } +} |
