Skip to content

Commit

Permalink
Add adult content test
Browse files Browse the repository at this point in the history
  • Loading branch information
pfrazee committed Mar 10, 2024
1 parent 2b05b41 commit b2eb80d
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions packages/api/tests/moderation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,4 +650,51 @@ describe('Moderation', () => {
expect(res.ui('contentView')).toBeModerationResult(['blur', 'noOverride'])
expect(res.ui('contentMedia')).toBeModerationResult([])
})

it('Adult content disabled forces the preference to hide', () => {
const modOpts = {
userDid: 'did:web:alice.test',
prefs: {
adultContentEnabled: false,
labels: { porn: 'ignore' },
labelers: [
{
did: 'did:web:labeler.test',
labels: {},
},
],
},
labelDefs: {},
}
const res = moderatePost(
mock.postView({
record: {
text: 'Hello',
createdAt: new Date().toISOString(),
},
author: mock.profileViewBasic({
handle: 'bob.test',
displayName: 'Bob',
}),
labels: [
{
src: 'did:web:labeler.test',
uri: 'at://did:web:bob.test/app.bsky.post/fake',
val: 'porn',
cts: new Date().toISOString(),
},
],
}),
modOpts,
)

expect(res.ui('profileList')).toBeModerationResult([])
expect(res.ui('profileView')).toBeModerationResult([])
expect(res.ui('avatar')).toBeModerationResult([])
expect(res.ui('banner')).toBeModerationResult([])
expect(res.ui('displayName')).toBeModerationResult([])
expect(res.ui('contentList')).toBeModerationResult(['filter'])
expect(res.ui('contentView')).toBeModerationResult([])
expect(res.ui('contentMedia')).toBeModerationResult(['blur', 'noOverride'])
})
})

0 comments on commit b2eb80d

Please sign in to comment.