Skip to content

Commit

Permalink
Last two type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
estrattonbailey committed Jul 26, 2024
1 parent e59c3d1 commit 0508d74
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions packages/api/tests/moderation-mutewords.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,64 @@ describe(`hasMutedWord`, () => {
})
})

describe(`facet with multiple features`, () => {
it(`multiple tags`, () => {
const match = hasMutedWord({
mutedWords: [
{ value: 'bad', targets: ['content'], actorTarget: 'all' },
],
text: 'tags',
facets: [
{
features: [
{
$type: 'app.bsky.richtext.facet#tag',
tag: 'good',
},
{
$type: 'app.bsky.richtext.facet#tag',
tag: 'bad',
},
],
index: {
byteEnd: 4,
byteStart: 0,
},
},
],
})
expect(match).toBe(true)
})

it(`other features`, () => {
const match = hasMutedWord({
mutedWords: [
{ value: 'bad', targets: ['content'], actorTarget: 'all' },
],
text: 'test',
facets: [
{
features: [
{
$type: 'com.example.richtext.facet#other',
foo: 'bar',
},
{
$type: 'app.bsky.richtext.facet#tag',
tag: 'bad',
},
],
index: {
byteEnd: 4,
byteStart: 0,
},
},
],
})
expect(match).toBe(true)
})
})

describe(`doesn't mute own post`, () => {
it(`does mute if it isn't own post`, () => {
const res = moderatePost(
Expand Down

0 comments on commit 0508d74

Please sign in to comment.