summaryrefslogtreecommitdiff
path: root/internal/federation/federatingactor_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-05-28 21:05:15 +0200
committerLibravatar GitHub <noreply@github.com>2023-05-28 20:05:15 +0100
commit46d4ec0f05fd424321e40dc574e4707fc9be8297 (patch)
treeb3bda98ab5722efc85a9bea588cf27c37926a4b3 /internal/federation/federatingactor_test.go
parent[chore] tidy up media manager, add calling func to errors, build-script impro... (diff)
downloadgotosocial-46d4ec0f05fd424321e40dc574e4707fc9be8297.tar.xz
[bugfix/chore] Inbox post updates (#1821)
Co-authored-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/federation/federatingactor_test.go')
-rw-r--r--internal/federation/federatingactor_test.go48
1 files changed, 48 insertions, 0 deletions
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)
+ }
+ }
+}