add filters for following feed

This commit is contained in:
Hazel K 2024-10-09 15:09:55 -04:00 committed by Hazelnoot
parent 56e7d7e0b1
commit 463b9ac59d
16 changed files with 318 additions and 72 deletions

View file

@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { isQuote, isRenote } from '@/misc/is-renote.js';
import { isPureRenote, isQuote, isRenote } from '@/misc/is-renote.js';
import { MiNote } from '@/models/Note.js';
const base: MiNote = {
@ -86,4 +86,25 @@ describe('misc:is-renote', () => {
expect(isRenote(note)).toBe(true);
expect(isQuote(note as any)).toBe(true);
});
describe('isPureRenote', () => {
it('should return true when note is pure renote', () => {
const note = new MiNote({ renoteId: 'abc123' });
const result = isPureRenote(note);
expect(result).toBeTruthy();
});
it('should return false when note is quote', () => {
const note = new MiNote({ renoteId: 'abc123', text: 'text' });
const result = isPureRenote(note);
expect(result).toBeFalsy();
});
it('should return false when note is not renote', () => {
const note = new MiNote({ renoteId: null });
const result = isPureRenote(note);
expect(result).toBeFalsy();
});
});
});