From 46d4ec0f05fd424321e40dc574e4707fc9be8297 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sun, 28 May 2023 21:05:15 +0200 Subject: [bugfix/chore] Inbox post updates (#1821) Co-authored-by: kim --- internal/federation/federatingactor_test.go | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'internal/federation/federatingactor_test.go') diff --git a/internal/federation/federatingactor_test.go b/internal/federation/federatingactor_test.go index 604f458f5..a8f71af4c 100644 --- a/internal/federation/federatingactor_test.go +++ b/internal/federation/federatingactor_test.go @@ -151,3 +151,51 @@ func (suite *FederatingActorTestSuite) TestSendRemoteFollower() { func TestFederatingActorTestSuite(t *testing.T) { suite.Run(t, new(FederatingActorTestSuite)) } + +func TestIsASMediaType(t *testing.T) { + for _, test := range []struct { + Input string + Expect bool + }{ + { + Input: "application/activity+json", + Expect: true, + }, + { + Input: "application/ld+json;profile=https://www.w3.org/ns/activitystreams", + Expect: true, + }, + { + Input: "application/ld+json;profile=\"https://www.w3.org/ns/activitystreams\"", + Expect: true, + }, + { + Input: "application/ld+json ;profile=https://www.w3.org/ns/activitystreams", + Expect: true, + }, + { + Input: "application/ld+json ;profile=\"https://www.w3.org/ns/activitystreams\"", + Expect: true, + }, + { + Input: "application/ld+json ; profile=https://www.w3.org/ns/activitystreams", + Expect: true, + }, + { + Input: "application/ld+json ; profile=\"https://www.w3.org/ns/activitystreams\"", + Expect: true, + }, + { + Input: "application/ld+json; profile=https://www.w3.org/ns/activitystreams", + Expect: true, + }, + { + Input: "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"", + Expect: true, + }, + } { + if federation.IsASMediaType(test.Input) != test.Expect { + t.Errorf("did not get expected result %v for input: %s", test.Expect, test.Input) + } + } +} -- cgit v1.2.3