summaryrefslogtreecommitdiff
path: root/internal/typeutils/wrap_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/typeutils/wrap_test.go')
-rw-r--r--internal/typeutils/wrap_test.go80
1 files changed, 80 insertions, 0 deletions
diff --git a/internal/typeutils/wrap_test.go b/internal/typeutils/wrap_test.go
index 1085c8c66..8c8af7506 100644
--- a/internal/typeutils/wrap_test.go
+++ b/internal/typeutils/wrap_test.go
@@ -139,6 +139,86 @@ func (suite *WrapTestSuite) TestWrapNoteInCreate() {
}`, string(bytes))
}
+func (suite *WrapTestSuite) TestWrapAccountableInUpdate() {
+ testAccount := suite.testAccounts["local_account_1"]
+
+ accountable, err := suite.typeconverter.AccountToAS(context.Background(), testAccount)
+ if err != nil {
+ suite.FailNow(err.Error())
+ }
+
+ create, err := suite.typeconverter.WrapAccountableInUpdate(accountable)
+ if err != nil {
+ suite.FailNow(err.Error())
+ }
+
+ createI, err := ap.Serialize(create)
+ if err != nil {
+ suite.FailNow(err.Error())
+ }
+
+ // Get the ID as it's not determinate.
+ createID := ap.GetJSONLDId(create)
+
+ bytes, err := json.MarshalIndent(createI, "", " ")
+ if err != nil {
+ suite.FailNow(err.Error())
+ }
+
+ suite.Equal(`{
+ "@context": [
+ "https://w3id.org/security/v1",
+ "https://www.w3.org/ns/activitystreams",
+ {
+ "discoverable": "toot:discoverable",
+ "featured": {
+ "@id": "toot:featured",
+ "@type": "@id"
+ },
+ "manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
+ "toot": "http://joinmastodon.org/ns#"
+ }
+ ],
+ "actor": "http://localhost:8080/users/the_mighty_zork",
+ "bcc": "http://localhost:8080/users/the_mighty_zork/followers",
+ "id": "`+createID.String()+`",
+ "object": {
+ "discoverable": true,
+ "featured": "http://localhost:8080/users/the_mighty_zork/collections/featured",
+ "followers": "http://localhost:8080/users/the_mighty_zork/followers",
+ "following": "http://localhost:8080/users/the_mighty_zork/following",
+ "icon": {
+ "mediaType": "image/jpeg",
+ "type": "Image",
+ "url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg"
+ },
+ "id": "http://localhost:8080/users/the_mighty_zork",
+ "image": {
+ "mediaType": "image/jpeg",
+ "type": "Image",
+ "url": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg"
+ },
+ "inbox": "http://localhost:8080/users/the_mighty_zork/inbox",
+ "manuallyApprovesFollowers": false,
+ "name": "original zork (he/they)",
+ "outbox": "http://localhost:8080/users/the_mighty_zork/outbox",
+ "preferredUsername": "the_mighty_zork",
+ "publicKey": {
+ "id": "http://localhost:8080/users/the_mighty_zork/main-key",
+ "owner": "http://localhost:8080/users/the_mighty_zork",
+ "publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwXTcOAvM1Jiw5Ffpk0qn\nr0cwbNvFe/5zQ+Tp7tumK/ZnT37o7X0FUEXrxNi+dkhmeJ0gsaiN+JQGNUewvpSk\nPIAXKvi908aSfCGjs7bGlJCJCuDuL5d6m7hZnP9rt9fJc70GElPpG0jc9fXwlz7T\nlsPb2ecatmG05Y4jPwdC+oN4MNCv9yQzEvCVMzl76EJaM602kIHC1CISn0rDFmYd\n9rSN7XPlNJw1F6PbpJ/BWQ+pXHKw3OEwNTETAUNYiVGnZU+B7a7bZC9f6/aPbJuV\nt8Qmg+UnDvW1Y8gmfHnxaWG2f5TDBvCHmcYtucIZPLQD4trAozC4ryqlmCWQNKbt\n0wIDAQAB\n-----END PUBLIC KEY-----\n"
+ },
+ "published": "2022-05-20T11:09:18Z",
+ "summary": "\u003cp\u003ehey yo this is my profile!\u003c/p\u003e",
+ "tag": [],
+ "type": "Person",
+ "url": "http://localhost:8080/@the_mighty_zork"
+ },
+ "to": "https://www.w3.org/ns/activitystreams#Public",
+ "type": "Update"
+}`, string(bytes))
+}
+
func TestWrapTestSuite(t *testing.T) {
suite.Run(t, new(WrapTestSuite))
}