Skip to content

Commit

Permalink
tighten up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
estrattonbailey committed Aug 9, 2023
1 parent 55f3323 commit f41e76a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
17 changes: 15 additions & 2 deletions packages/bsky/tests/views/author-feed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ describe('pds author feed views', () => {
expect(
allFeed.feed.some(({ post }) => {
return (
isEmbedRecordWithMedia(post.embed) && isImageEmbed(post.embed?.media)
(isEmbedRecordWithMedia(post.embed) &&
isImageEmbed(post.embed?.media)) ||
isImageEmbed(post.embed)
)
}),
).toBeTruthy()
Expand All @@ -258,14 +260,25 @@ describe('pds author feed views', () => {
actor: carol,
filter: 'posts_with_media',
})
const { data: imagesOnlyFeed } = await agent.api.app.bsky.feed.getAuthorFeed({
actor: bob,
filter: 'posts_with_media',
})

expect(
mediaFeed.feed.every(({ post }) => {
return (
isEmbedRecordWithMedia(post.embed) && isImageEmbed(post.embed?.media)
(isEmbedRecordWithMedia(post.embed) &&
isImageEmbed(post.embed?.media)) ||
isImageEmbed(post.embed)
)
}),
).toBeTruthy()
expect(
imagesOnlyFeed.feed.every(({ post }) => {
return isImageEmbed(post.embed)
}),
).toBeTruthy()

const { data: postsOnlyFeed } = await agent.api.app.bsky.feed.getAuthorFeed(
{ actor: carol, filter: 'posts_no_replies' },
Expand Down
22 changes: 20 additions & 2 deletions packages/pds/tests/views/author-feed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ describe('pds author feed views', () => {
expect(
allFeed.feed.some(({ post }) => {
return (
isEmbedRecordWithMedia(post.embed) && isImageEmbed(post.embed?.media)
(isEmbedRecordWithMedia(post.embed) &&
isImageEmbed(post.embed?.media)) ||
isImageEmbed(post.embed)
)
}),
).toBeTruthy()
Expand All @@ -307,14 +309,30 @@ describe('pds author feed views', () => {
headers: sc.getHeaders(alice),
},
)
const { data: imagesOnlyFeed } = await agent.api.app.bsky.feed.getAuthorFeed(
{
actor: bob,
filter: 'posts_with_media',
},
{
headers: sc.getHeaders(alice),
},
)

expect(
mediaFeed.feed.every(({ post }) => {
return (
isEmbedRecordWithMedia(post.embed) && isImageEmbed(post.embed?.media)
(isEmbedRecordWithMedia(post.embed) &&
isImageEmbed(post.embed?.media)) ||
isImageEmbed(post.embed)
)
}),
).toBeTruthy()
expect(
imagesOnlyFeed.feed.every(({ post }) => {
return isImageEmbed(post.embed)
}),
).toBeTruthy()

const { data: postsOnlyFeed } = await agent.api.app.bsky.feed.getAuthorFeed(
{ actor: carol, filter: 'posts_no_replies' },
Expand Down

0 comments on commit f41e76a

Please sign in to comment.