mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Option to hide followers/following (#2788)
This commit is contained in:
@@ -49,6 +49,7 @@ func TestASCollection(t *testing.T) {
|
||||
// Create new collection using builder function.
|
||||
c := ap.NewASCollection(ap.CollectionParams{
|
||||
ID: parseURI(idURI),
|
||||
First: new(paging.Page),
|
||||
Query: url.Values{"limit": []string{"40"}},
|
||||
Total: total,
|
||||
})
|
||||
@@ -60,6 +61,37 @@ func TestASCollection(t *testing.T) {
|
||||
assert.Equal(t, expect, s)
|
||||
}
|
||||
|
||||
func TestASCollectionTotalOnly(t *testing.T) {
|
||||
const (
|
||||
proto = "https"
|
||||
host = "zorg.flabormagorg.xyz"
|
||||
path = "/users/itsa_me_mario"
|
||||
|
||||
idURI = proto + "://" + host + path
|
||||
total = 10
|
||||
)
|
||||
|
||||
// Create JSON string of expected output.
|
||||
expect := toJSON(map[string]any{
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
"type": "Collection",
|
||||
"id": idURI,
|
||||
"totalItems": total,
|
||||
})
|
||||
|
||||
// Create new collection using builder function.
|
||||
c := ap.NewASCollection(ap.CollectionParams{
|
||||
ID: parseURI(idURI),
|
||||
Total: total,
|
||||
})
|
||||
|
||||
// Serialize collection.
|
||||
s := toJSON(c)
|
||||
|
||||
// Ensure outputs are equal.
|
||||
assert.Equal(t, expect, s)
|
||||
}
|
||||
|
||||
func TestASCollectionPage(t *testing.T) {
|
||||
const (
|
||||
proto = "https"
|
||||
@@ -132,6 +164,7 @@ func TestASOrderedCollection(t *testing.T) {
|
||||
// Create new collection using builder function.
|
||||
c := ap.NewASOrderedCollection(ap.CollectionParams{
|
||||
ID: parseURI(idURI),
|
||||
First: new(paging.Page),
|
||||
Query: url.Values{"limit": []string{"40"}},
|
||||
Total: total,
|
||||
})
|
||||
@@ -143,6 +176,33 @@ func TestASOrderedCollection(t *testing.T) {
|
||||
assert.Equal(t, expect, s)
|
||||
}
|
||||
|
||||
func TestASOrderedCollectionTotalOnly(t *testing.T) {
|
||||
const (
|
||||
idURI = "https://zorg.flabormagorg.xyz/users/itsa_me_mario"
|
||||
total = 10
|
||||
)
|
||||
|
||||
// Create JSON string of expected output.
|
||||
expect := toJSON(map[string]any{
|
||||
"@context": "https://www.w3.org/ns/activitystreams",
|
||||
"type": "OrderedCollection",
|
||||
"id": idURI,
|
||||
"totalItems": total,
|
||||
})
|
||||
|
||||
// Create new collection using builder function.
|
||||
c := ap.NewASOrderedCollection(ap.CollectionParams{
|
||||
ID: parseURI(idURI),
|
||||
Total: total,
|
||||
})
|
||||
|
||||
// Serialize collection.
|
||||
s := toJSON(c)
|
||||
|
||||
// Ensure outputs are equal.
|
||||
assert.Equal(t, expect, s)
|
||||
}
|
||||
|
||||
func TestASOrderedCollectionPage(t *testing.T) {
|
||||
const (
|
||||
proto = "https"
|
||||
|
Reference in New Issue
Block a user