Something went wrong. Try again.
A Bluesky TUI Client. (Alpha)
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839import { describe, expect, it } from 'vitest';import type { Post } from '../core/models/post.js';import type { Thread } from '../core/models/thread.js';import { flattenThreadReplies } from './thread.js';
function post(uri: string): Post { return { uri, cid: 'c', author: { did: 'did:plc:a', handle: 'a.test' }, text: uri, createdAt: '2026-06-24T00:00:00.000Z', indexedAt: '2026-06-24T00:00:00.000Z', stats: { replies: 0, reposts: 0, likes: 0 }, viewer: {}, labels: [], };}
describe('flattenThreadReplies', () => { it('returns the focus then replies depth-first with depth annotations', () => { const thread: Thread = { ancestors: [], focus: post('focus'), replies: [ { post: post('r1'), replies: [{ post: post('r1a'), replies: [] }] }, { post: post('r2'), replies: [] }, ], };
expect(flattenThreadReplies(thread)).toEqual([ { post: post('focus'), depth: 0 }, { post: post('r1'), depth: 1 }, { post: post('r1a'), depth: 2 }, { post: post('r2'), depth: 1 }, ]); });});