-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
smol change. couple of new rules need avatar cids. currently have to fetch from public api before the rule processes in a separate request which is meh, since we have the info here already.
- Loading branch information
Showing
4 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package engine | ||
|
||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestCidFromCdnUrl(t *testing.T) { | ||
assert := assert.New(t) | ||
|
||
fixCid := "abcdefghijk" | ||
|
||
fixtures := []struct { | ||
url string | ||
cid *string | ||
}{ | ||
{ | ||
url: "https://cdn.bsky.app/img/avatar/plain/did:plc:abc123/abcdefghijk@jpeg", | ||
cid: &fixCid, | ||
}, | ||
{ | ||
url: "https://cdn.bsky.app/img/feed_fullsize/plain/did:plc:abc123/abcdefghijk@jpeg", | ||
cid: &fixCid, | ||
}, | ||
{ | ||
url: "https://cdn.bsky.app/img/feed_fullsize", | ||
cid: nil, | ||
}, | ||
{ | ||
url: "https://cdn.bsky.app/img/feed_fullsize/plain/did:plc:abc123/abcdefghijk", | ||
cid: &fixCid, | ||
}, | ||
{ | ||
url: "https://cdn.asky.app/img/feed_fullsize/plain/did:plc:abc123/abcdefghijk@jpeg", | ||
cid: nil, | ||
}, | ||
} | ||
|
||
for _, fix := range fixtures { | ||
assert.Equal(fix.cid, cidFromCdnUrl(&fix.url)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters