From 92c089a4e29730a9842e22ff2c69fe069df601d4 Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 23 Nov 2023 17:02:54 +0100 Subject: [PATCH] Add a test for getting host and port --- models/activitypub/actor_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/models/activitypub/actor_test.go b/models/activitypub/actor_test.go index f96ca74e61..a7e127d9e0 100644 --- a/models/activitypub/actor_test.go +++ b/models/activitypub/actor_test.go @@ -58,3 +58,21 @@ func TestValidateInvalid(t *testing.T) { t.Errorf("Validating actor returned nil with false input.") } } + +func TestGetHostAndPort(t *testing.T) { + item := ActorID{ + schema: "https", + userId: "1", + path: "/api/v1/activitypub/user-id/1", + host: "repo.prod.meissa.de", + port: "80", + } + want := "repo.prod.meissa.de:80" + + hostAndPort := item.GetHostAndPort() + + if hostAndPort != want { + t.Errorf("GetHostAndPort did not return correct host and port combination: %v", hostAndPort) + } + +}