项目文件夹

文件
wehub-resource-sync 2114b14ee0
Sync main into demo / sync (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:26 +08:00

45 行
1.1 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { collectRedditCommentDeletionIds } from '../apps/Reddit/utils/commentTree';
import type { Comment } from '../apps/Reddit/types';
describe('Reddit comment deletion helpers', () => {
it('collects an own comment and its own descendants only', () => {
const comments: Record<string, Comment> = {
root: {
id: 'root',
postId: 'post_1',
author: 'me',
body: 'root',
},
child: {
id: 'child',
postId: 'post_1',
parentId: 'root',
author: 'me',
body: 'child',
},
grandchild: {
id: 'grandchild',
postId: 'post_1',
parentId: 'child',
author: 'me',
body: 'grandchild',
},
otherUserChild: {
id: 'otherUserChild',
postId: 'post_1',
parentId: 'root',
author: 'someone_else',
body: 'keep',
},
};
expect(collectRedditCommentDeletionIds(comments, 'root', 'me')).toEqual([
'root',
'child',
'grandchild',
]);
});
});