From 0508d741c64751ae7cb0128dae8142d727c37e21 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Fri, 26 Jul 2024 11:10:34 -0500 Subject: [PATCH] Last two type fixes --- .../api/tests/moderation-mutewords.test.ts | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/packages/api/tests/moderation-mutewords.test.ts b/packages/api/tests/moderation-mutewords.test.ts index 26de3fe9872..681dddc73d8 100644 --- a/packages/api/tests/moderation-mutewords.test.ts +++ b/packages/api/tests/moderation-mutewords.test.ts @@ -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(