1package main
2
3import (
4 "testing"
5
6 "github.com/stretchr/testify/assert"
7)
8
9func TestParseServiceURL(t *testing.T) {
10 assert := assert.New(t)
11
12 testVec := [][]string{
13 {"", ""},
14 {"atproto.com", "atproto.com"},
15 {"https://bsky.app/profile/atproto.com", "atproto.com"},
16 {"https://bsky.app/profile/did:plc:ewvi7nxzyoun6zhxrhs64oiz", "did:plc:ewvi7nxzyoun6zhxrhs64oiz"},
17 {"https://bsky.app/profile/atproto.com/post/3lffzv6f4o22r", "at://atproto.com/app.bsky.feed.post/3lffzv6f4o22r"},
18 }
19
20 for _, pair := range testVec {
21 assert.Equal(pair[1], ParseServiceURL(pair[0]))
22 }
23}