Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-29 05:06:11 +01:00

Fix tests

This commit is contained in:
erik 2023-12-06 16:14:50 +01:00 committed by Michael Jerger
parent 68cd621053
commit 02dc8901af

View file

@ -29,10 +29,10 @@ var mockStar *forgefed.Star = &forgefed.Star{
} }
func TestActorParserEmpty(t *testing.T) { func TestActorParserEmpty(t *testing.T) {
item := emptyMockStar item := ""
want := ActorID{} want := ActorID{}
got, _ := ParseActorIDFromStarActivity(item) got, _ := ParseActorID(item, "forgejo")
if got != want { if got != want {
t.Errorf("ParseActorID returned non empty actor id for empty input.") t.Errorf("ParseActorID returned non empty actor id for empty input.")
@ -40,17 +40,17 @@ func TestActorParserEmpty(t *testing.T) {
} }
func TestActorParserValid(t *testing.T) { func TestActorParserValid(t *testing.T) {
item := mockStar item := mockStar.Actor.GetID().String()
want := ActorID{ want := ActorID{
userId: "1", userId: "1",
source: "forgejo", source: "forgejo",
schema: "https", schema: "https",
path: "/api/v1/activitypub/user-id/1", path: "api/v1/activitypub/user-id",
host: "repo.prod.meissa.de", host: "repo.prod.meissa.de",
port: "", port: "",
} }
got, _ := ParseActorIDFromStarActivity(item) got, _ := ParseActorID(item, "forgejo")
if got != want { if got != want {
t.Errorf("\nParseActorID did not return want: %v\n but %v", want, got) t.Errorf("\nParseActorID did not return want: %v\n but %v", want, got)
@ -73,9 +73,9 @@ func TestValidateValid(t *testing.T) {
} }
func TestValidateInvalid(t *testing.T) { func TestValidateInvalid(t *testing.T) {
item := emptyMockStar item := emptyMockStar.Actor.GetID().String()
actor, _ := ParseActorIDFromStarActivity(item) actor, _ := ParseActorID(item, "forgejo")
if valid, _ := actor.IsValid(); valid { if valid, _ := actor.IsValid(); valid {
t.Errorf("Actor was valid with invalid input.") t.Errorf("Actor was valid with invalid input.")