Something went wrong. Try again.
Mirror — see github.com/blacksky-algorithms/blacksky.community
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647import {getCommunitySpaceUri, isPeerModLabelableUri} from '../community-post'
const post = (communitySpace?: unknown) => ({ uri: 'at://did:plc:author/community.blacksky.feed.post/3m2post', communitySpace, }) as never
describe(getCommunitySpaceUri, () => { it('accepts a space URI', () => { const space = 'at://did:plc:community/space/community.blacksky.feed/private'
expect(getCommunitySpaceUri(post(space))).toBe(space) })
it.each([ undefined, 42, 'not-an-at-uri', // A feed generator URI is not a space: the field names where content // lives, and a feed is only a view over it. 'at://did:plc:community/app.bsky.feed.generator/3m2communityfeed', 'at://did:plc:community/community.blacksky.feed.config/3m2communityfeed', // A record inside a space is not the space itself. 'at://did:plc:c/space/community.blacksky.feed/main/did:plc:a/app.bsky.feed.post/3k', ])('rejects absent or invalid space context: %p', communitySpace => { expect(getCommunitySpaceUri(post(communitySpace))).toBeUndefined() })})
describe(isPeerModLabelableUri, () => { it.each([ 'at://did:plc:a/app.bsky.feed.post/3k', 'at://did:plc:a/community.blacksky.feed.post/3k', ])('accepts %s', uri => { expect(isPeerModLabelableUri(uri)).toBe(true) })
it.each([ 'at://did:plc:a/app.bsky.feed.generator/3k', 'at://did:plc:a/app.bsky.feed.repost/3k', 'at://did:plc:c/space/community.blacksky.feed/main/did:plc:a/app.bsky.feed.post/3k', ])('rejects %s', uri => { expect(isPeerModLabelableUri(uri)).toBe(false) })})