GoAT Site is library that implements Standard.site in Go.
atprotocol standard-site atproto library
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat(lexicon): tests for blob

+37 -16
+2 -8
document_test.go
··· 70 70 if !doc.PublishedAt.Equal(publishedAt) { 71 71 t.Errorf("invalid publishedAt: %s, wanted %s", doc.PublishedAt, publishedAt) 72 72 } 73 - if doc.CoverImage.CID != coverImage.CID { 74 - t.Errorf("invalid cover image CID: %s, wanted %s", doc.CoverImage.CID, coverImage.CID) 75 - } 76 - if doc.CoverImage.MimeType != coverImage.MimeType { 77 - t.Errorf("invalid cover image MimeType: %s, wanted %s", doc.CoverImage.MimeType, coverImage.MimeType) 78 - } 79 - if doc.CoverImage.Size != coverImage.Size { 80 - t.Errorf("invalid cover image Size: %d, wanted %d", doc.CoverImage.Size, coverImage.Size) 73 + if *doc.CoverImage != *coverImage { 74 + t.Errorf("invalid cover image: %v, wanted %v", *doc.CoverImage, *coverImage) 81 75 } 82 76 if *doc.Path != path { 83 77 t.Errorf("invalid path: %s, wanted %s", *doc.Path, path)
+33
lexicons_test.go
··· 2 2 3 3 import ( 4 4 "context" 5 + "encoding/json" 6 + "testing" 5 7 "time" 6 8 7 9 "github.com/bluesky-social/indigo/atproto/atclient" ··· 50 52 func genTime(t *rapid.T, label string) time.Time { 51 53 return time.Unix(int64(rapid.Uint32().Draw(t, label)), 0) 52 54 } 55 + 56 + func TestBlob_JSON(t *testing.T) { 57 + rapid.Check(t, func(t *rapid.T) { 58 + base := rapid.StringN(1, -1, 10).Draw(t, "mimeType") 59 + blob, blobRaw := genBlob(t, base, "blob") 60 + b, err := json.Marshal(blobRaw) 61 + if err != nil { 62 + t.Fatal(err) 63 + } 64 + var v *site.RecordJSON 65 + err = json.Unmarshal(b, &v) 66 + if err != nil { 67 + t.Fatal(err) 68 + } 69 + bl := v.Record.(*site.Blob) 70 + if bl.CID != blob.CID { 71 + t.Errorf("invalid CID: %s, wanted %s", bl.CID, blob.CID) 72 + } 73 + if bl.MimeType != blob.MimeType { 74 + t.Errorf("invalid mimeType: %s, wanted %s", bl.MimeType, blob.MimeType) 75 + } 76 + if bl.Size != blob.Size { 77 + t.Errorf("invalid size: %d, wanted %d", bl.Size, blob.Size) 78 + } 79 + b, err = json.Marshal(bl) 80 + if err != nil { 81 + t.Fatal(err) 82 + } 83 + t.Log(string(b)) 84 + }) 85 + }
+2 -8
publication_test.go
··· 70 70 if *pub.Description != description { 71 71 t.Errorf("invalid description: %s, wanted %s", *pub.Description, description) 72 72 } 73 - if pub.Icon.CID != icon.CID { 74 - t.Errorf("invalid Icon CID: %s, wanted %s", pub.Icon.CID, icon.CID) 75 - } 76 - if pub.Icon.MimeType != icon.MimeType { 77 - t.Errorf("invalid Icon MimeType: %s, wanted %s", pub.Icon.MimeType, icon.MimeType) 78 - } 79 - if pub.Icon.Size != icon.Size { 80 - t.Errorf("invalid Icon Size: %d, wanted %d", pub.Icon.Size, icon.Size) 73 + if *pub.Icon != *icon { 74 + t.Errorf("invalid icon: %v, wanted %v", *pub.Icon, *icon) 81 75 } 82 76 if pub.Preferences.ShowInDiscover != showInDiscover { 83 77 t.Errorf("invalid Preferences ShowInDiscover: %v", pub.Preferences.ShowInDiscover)