Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.
feat(api)!: stop reading Reddit accounts and caches
spacesdriveab5d41694b36
diff --git a/backend/repositories/accountRepository.ts b/backend/repositories/accountRepository.tsindex 5af8bdc..83b9784 100644--- a/backend/repositories/accountRepository.ts+++ b/backend/repositories/accountRepository.ts@@ -11,6 +11,9 @@ interface AccountRow {const COLUMNS = 'id, platform, data';+// rows of a platform Twiligent no longer supports stay in the table until they are cleaned up, so reads leave them out+const SUPPORTED_PLATFORMS: Platform[] = ['youtube', 'instagram'];+function toAccount(row: AccountRow): Account {return { id: row.id, platform: row.platform, ...row.data };}@@ -30,7 +33,7 @@ export interface AccountRepository {export function createAccountRepository(db: SupabaseClient): AccountRepository {async function find(id: string, userId: string | null): Promise<Account | null> {const row = await maybeRow<AccountRow>('accounts.find', () => {- const query = db.from('accounts').select(COLUMNS).eq('id', id);+ const query = db.from('accounts').select(COLUMNS).eq('id', id).in('platform', SUPPORTED_PLATFORMS);return (userId ? query.eq('user_id', userId) : query).maybeSingle();});return row ? toAccount(row) : null;@@ -50,6 +53,7 @@ export function createAccountRepository(db: SupabaseClient): AccountRepository {.from('accounts').select(COLUMNS).eq('user_id', userId)+ .in('platform', SUPPORTED_PLATFORMS).order('created_at', { ascending: true }).order('id', { ascending: true }));return found.map(toAccount);diff --git a/backend/repositories/analyticsCacheRepository.ts b/backend/repositories/analyticsCacheRepository.tsindex 0aeb376..afac76f 100644--- a/backend/repositories/analyticsCacheRepository.ts+++ b/backend/repositories/analyticsCacheRepository.ts@@ -1,7 +1,6 @@import type { Redis } from '../types/app.ts';import type { VideosCacheData } from '../../shared/types/youtube.ts';import type { IGCacheData } from '../../shared/types/instagram.ts';-import type { RedditCacheData } from '../../shared/types/reddit.ts';// stats change constantly, so cached analytics expire instead of going staleconst ANALYTICS_TTL_SECONDS = 6 * 60 * 60;@@ -28,8 +27,6 @@ export interface AnalyticsCacheRepository {setVideos(userId: string, accountId: string, data: VideosCacheData): Promise<void>;getInstagramMedia(userId: string, accountId: string): Promise<Versioned<IGCacheData> | null>;setInstagramMedia(userId: string, accountId: string, data: IGCacheData): Promise<void>;- getReddit(userId: string, accountId: string): Promise<RedditCacheData | null>;- setReddit(userId: string, accountId: string, data: RedditCacheData): Promise<void>;deleteAllForAccount(userId: string, accountId: string): Promise<void>;}@@ -87,17 +84,10 @@ export function createAnalyticsCacheRepository(redis: Redis | null): AnalyticsCasetInstagramMedia: (userId, accountId, data) => writeKey(`ig:${userId}:${accountId}`, { ...data, version: IG_CACHE_VERSION }),- async getReddit(userId, accountId) {- return (await readKey<RedditCacheData>(`reddit:${userId}:${accountId}`)) || null;- },-- setReddit: (userId, accountId, data) => writeKey(`reddit:${userId}:${accountId}`, data),-async deleteAllForAccount(userId, accountId) {await Promise.all([deleteKey(`videos:${userId}:${accountId}`),deleteKey(`ig:${userId}:${accountId}`),- deleteKey(`reddit:${userId}:${accountId}`),]);},};diff --git a/backend/services/overviewService.ts b/backend/services/overviewService.tsindex 54bb7ff..394bfec 100644--- a/backend/services/overviewService.ts+++ b/backend/services/overviewService.ts@@ -1,15 +1,13 @@import { fetchAllVideos } from './youtube/youtubeVideos.ts';import { fetchInstagramMedia } from './instagram/instagramMedia.ts';import { summarizeContentTypes } from './instagram/instagramContentTypes.ts';-import { fetchRedditProfile, fetchRedditPosts } from './reddit/redditApi.ts';-import { computeRedditAnalytics } from './reddit/redditAnalytics.ts';import type { AccountRepository } from '../repositories/accountRepository.ts';import type { AnalyticsCacheRepository } from '../repositories/analyticsCacheRepository.ts';import type { TrackedPostRepository } from '../repositories/trackedPostRepository.ts';import type { AppConfig } from '../lib/config.ts';import type {- Account, AccountSummary, InstagramAccountSummary, OverviewAnalyticsCache, PendingAccountSummary, RedditAccountSummary,- TrackedPost, YouTubeAccountSummary,+ Account, AccountSummary, InstagramAccountSummary, OverviewAnalyticsCache, PendingAccountSummary, TrackedPost,+ YouTubeAccountSummary,} from '../../shared/types/domain.ts';export interface OverviewDeps {@@ -40,20 +38,6 @@ function sumBy<T>(items: T[], pick: (item: T) => number): number {}export function createOverviewService({ accounts, tracked, cache, config }: OverviewDeps): OverviewService {- function redditWarmTask(userId: string, account: Account): WarmTask | null {- const { username, cookie } = account;- if (!username || !cookie) return null;- return async signal => {- const [profile, posts] = await Promise.all([- fetchRedditProfile(username, cookie, signal),- fetchRedditPosts(username, cookie, 100, signal),- ]);- await cache.setReddit(userId, account.id, {- profile, analytics: computeRedditAnalytics(profile, posts), posts, fetchedAt: new Date().toISOString(),- });- };- }-function instagramWarmTask(userId: string, account: Account): WarmTask | null {const { igUserId, accessToken } = account;if (!igUserId || !accessToken) return null;@@ -85,19 +69,6 @@ export function createOverviewService({ accounts, tracked, cache, config }: Overreturn { id: accountId, cacheWarmed: false, syncing: true };};- const summarizeReddit = async (account: Account): Promise<RedditAccountSummary | PendingAccountSummary> => {- const cached = await cache.getReddit(userId, account.id);- if (!cached?.analytics) return startWarm(account.id, redditWarmTask(userId, account));- return {- id: account.id,- cacheWarmed: true,- fetchedAt: cached.fetchedAt,- fetchedPosts: cached.analytics.fetchedPosts ?? 0,- totalScore: cached.analytics.totalScore ?? 0,- totalComments: cached.analytics.totalComments ?? 0,- };- };-const summarizeInstagram = async (account: Account): Promise<InstagramAccountSummary | PendingAccountSummary> => {const cached = await cache.getInstagramMedia(userId, account.id);if (!cached?.media) return startWarm(account.id, instagramWarmTask(userId, account));@@ -127,7 +98,6 @@ export function createOverviewService({ accounts, tracked, cache, config }: Over};const summarize = (account: Account): Promise<AccountSummary> => {- if (account.platform === 'reddit') return summarizeReddit(account);if (account.platform === 'instagram') return summarizeInstagram(account);return summarizeYouTube(account);};diff --git a/backend/services/reddit/redditAnalytics.ts b/backend/services/reddit/redditAnalytics.tsdeleted file mode 100644index c4d7905..0000000--- a/backend/services/reddit/redditAnalytics.ts+++ /dev/null@@ -1,169 +0,0 @@-import {- DAY_NAMES, sumOf, roundedAverage, medianOf, countWithinDays, postFrequency,- consistencyScore, bestToAverageRatio, pickHighest, monthKey,-} from '../../lib/analyticsMath.ts';-import type {- RedditAnalytics, RedditPost, RedditProfile, RedditSubredditStats, RedditMediaType, RedditMonthStats,-} from '../../../shared/types/reddit.ts';--const MAX_SUBREDDITS = 20;--function emptyRedditAnalytics(): RedditAnalytics {- return {- fetchedPosts: 0, totalScore: 0, avgScore: 0, medianScore: 0,- totalComments: 0, avgComments: 0, avgUpvoteRatio: 0,- totalAwards: 0, avgAwards: 0,- topPosts: [], worstPosts: [], subredditBreakdown: [],- mediaTypeDistribution: {}, postsByDayOfWeek: [], postsByHour: [],- monthlyBreakdown: [], engagementTimeline: [],- postsLast7Days: 0, postsLast30Days: 0, postsLast90Days: 0,- postFrequency: { perWeek: 0, perMonth: 0 },- viralityScore: 0, consistencyScore: 0,- bestPostingDay: '', bestPostingHour: '',- };-}--type ScoreSummary = Pick<RedditAnalytics,- 'totalScore' | 'avgScore' | 'medianScore' | 'totalComments' | 'avgComments' | 'avgUpvoteRatio' | 'totalAwards' | 'avgAwards'>;--function summarizeScores(posts: RedditPost[]): ScoreSummary {- const totalScore = sumOf(posts, post => post.score);- const totalComments = sumOf(posts, post => post.numComments);- const totalAwards = sumOf(posts, post => post.awardsCount ?? 0);- const upvoteRatioSum = sumOf(posts, post => post.upvoteRatio);- return {- totalScore,- avgScore: Math.round(totalScore / posts.length),- medianScore: medianOf(posts.map(post => post.score)),- totalComments,- avgComments: Math.round(totalComments / posts.length),- avgUpvoteRatio: parseFloat((upvoteRatioSum / posts.length * 100).toFixed(1)),- totalAwards,- avgAwards: parseFloat((totalAwards / posts.length).toFixed(2)),- };-}--type SubredditTotals = Omit<RedditSubredditStats, 'avgScore' | 'avgComments'>;--function buildSubredditBreakdown(posts: RedditPost[]): RedditSubredditStats[] {- const subreddits: Record<string, SubredditTotals> = {};- posts.forEach(post => {- const name = post.subreddit;- if (!subreddits[name]) subreddits[name] = { subreddit: name, posts: 0, totalScore: 0, totalComments: 0 };- subreddits[name].posts++;- subreddits[name].totalScore += post.score;- subreddits[name].totalComments += post.numComments;- });- return Object.values(subreddits)- .map(entry => ({- ...entry,- avgScore: Math.round(entry.totalScore / entry.posts),- avgComments: Math.round(entry.totalComments / entry.posts),- }))- .sort((first, second) => second.posts - first.posts)- .slice(0, MAX_SUBREDDITS);-}--function buildMediaTypeDistribution(posts: RedditPost[]): Partial<Record<RedditMediaType, number>> {- const distribution: Partial<Record<RedditMediaType, number>> = {};- posts.forEach(post => { distribution[post.mediaType] = (distribution[post.mediaType] ?? 0) + 1; });- return distribution;-}--// dates skips undated posts yet is indexed by posts, matching stored analytics-function fillTimeBuckets(dates: Date[], posts: RedditPost[]) {- const dayBuckets = Array(7).fill(null).map(() => ({ count: 0, score: 0, comments: 0 }));- const hourBuckets = Array(24).fill(null).map(() => ({ count: 0, score: 0 }));- dates.forEach((date, i) => {- const dayBucket = dayBuckets[date.getDay()];- dayBucket.count++;- dayBucket.score += posts[i]?.score ?? 0;- dayBucket.comments += posts[i]?.numComments ?? 0;- const hourBucket = hourBuckets[date.getHours()];- hourBucket.count++;- hourBucket.score += posts[i]?.score ?? 0;- });- return { dayBuckets, hourBuckets };-}--type TimingSummary = Pick<RedditAnalytics, 'postsByDayOfWeek' | 'bestPostingDay' | 'postsByHour' | 'bestPostingHour'>;--function summarizeTiming(dates: Date[], posts: RedditPost[]): TimingSummary {- const { dayBuckets, hourBuckets } = fillTimeBuckets(dates, posts);- const postsByDayOfWeek = dayBuckets.map((bucket, i) => ({- day: DAY_NAMES[i], shortDay: DAY_NAMES[i].slice(0, 3),- posts: bucket.count,- avgScore: roundedAverage(bucket.score, bucket.count),- avgComments: roundedAverage(bucket.comments, bucket.count),- }));- const postsByHour = hourBuckets.map((bucket, i) => ({- hour: i, label: `${i}:00`,- posts: bucket.count,- avgScore: roundedAverage(bucket.score, bucket.count),- }));- const bestDay = pickHighest(postsByDayOfWeek, 'avgScore');- const bestHour = pickHighest(postsByHour, 'avgScore');- return {- postsByDayOfWeek, bestPostingDay: bestDay?.day ?? '',- postsByHour, bestPostingHour: bestHour && bestHour.posts > 0 ? bestHour.label : '',- };-}--interface MonthTotals {- posts: number;- score: number;- comments: number;-}--function buildMonthlyBreakdown(posts: RedditPost[]): RedditMonthStats[] {- const months: Record<string, MonthTotals> = {};- posts.forEach(post => {- if (!post.createdAt) return;- const date = new Date(post.createdAt);- if (Number.isNaN(date.getTime())) return;- const key = monthKey(date);- if (!months[key]) months[key] = { posts: 0, score: 0, comments: 0 };- months[key].posts++;- months[key].score += post.score;- months[key].comments += post.numComments;- });- return Object.entries(months)- .sort(([first], [second]) => first.localeCompare(second))- .map(([month, totals]) => ({- month, posts: totals.posts, score: totals.score, comments: totals.comments,- avgScore: Math.round(totals.score / totals.posts),- }));-}--function countRecentPosts(dates: Date[]): Pick<RedditAnalytics, 'postsLast7Days' | 'postsLast30Days' | 'postsLast90Days'> {- const now = Date.now();- return {- postsLast7Days: countWithinDays(dates, now, 7),- postsLast30Days: countWithinDays(dates, now, 30),- postsLast90Days: countWithinDays(dates, now, 90),- };-}--export function computeRedditAnalytics(_profile: RedditProfile, posts: RedditPost[] | null | undefined): RedditAnalytics {- if (!posts || posts.length === 0) return emptyRedditAnalytics();-- const scores = summarizeScores(posts);- const byScore = [...posts].sort((first, second) => second.score - first.score);- const dates = posts.map(post => (post.createdAt ? new Date(post.createdAt) : null)).filter(Boolean) as Date[];- const monthlyBreakdown = buildMonthlyBreakdown(posts);-- return {- fetchedPosts: posts.length,- ...scores,- topPosts: byScore.slice(0, 10),- worstPosts: byScore.slice(-5).reverse(),- subredditBreakdown: buildSubredditBreakdown(posts),- mediaTypeDistribution: buildMediaTypeDistribution(posts),- ...summarizeTiming(dates, posts),- monthlyBreakdown, engagementTimeline: monthlyBreakdown,- ...countRecentPosts(dates),- postFrequency: postFrequency(dates, posts.length),- viralityScore: bestToAverageRatio(byScore[0]?.score ?? 0, scores.avgScore),- consistencyScore: consistencyScore(posts.map(post => post.score)),- };-}diff --git a/backend/services/reddit/redditApi.ts b/backend/services/reddit/redditApi.tsdeleted file mode 100644index bce941f..0000000--- a/backend/services/reddit/redditApi.ts+++ /dev/null@@ -1,199 +0,0 @@-import type { RedditMediaType, RedditPost, RedditProfile, RedditTrackedPostData } from '../../../shared/types/reddit.ts';-import { createCircuitBreaker } from '../../lib/circuitBreaker.ts';-import { NotFoundError, UpstreamError, UpstreamTimeoutError, ValidationError, isAbortError } from '../../lib/errors.ts';--export { computeRedditAnalytics } from './redditAnalytics.ts';--// fetch is a worker global; requests send the stored reddit_session cookie-const REDDIT_BASE = 'https://www.reddit.com';-// reddit requires <platform>:<appid>:<version> (by /u/<username>)-const USER_AGENT = 'script:twiligent:v1.0 (by /u/spacesdrive)';--interface RedditApiError {- error?: number | string;- message?: string;-}--interface RedditApiUser {- name: string;- total_karma?: number;- link_karma?: number;- comment_karma?: number;- awardee_karma?: number;- awarder_karma?: number;- icon_img?: string;- snoovatar_img?: string;- created_utc?: number;- is_gold?: boolean;- is_mod?: boolean;- verified?: boolean;-}--interface RedditApiPost {- id: string;- title: string;- subreddit: string;- subreddit_name_prefixed?: string;- author?: string;- score?: number;- upvote_ratio?: number;- num_comments?: number;- url?: string;- permalink: string;- thumbnail?: string;- post_hint?: string;- is_self?: boolean;- is_video?: boolean;- over_18?: boolean;- created_utc?: number;- link_flair_text?: string | null;- total_awards_received?: number;-}--interface RedditThing<T> {- kind?: string;- data: T;-}--interface RedditListing<T> {- data?: {- children?: RedditThing<T>[];- after?: string | null;- };-}--type RedditCookie = string | null | undefined;--export const redditCircuit = createCircuitBreaker('Reddit');--function redditFetch<T>(path: string, cookie: RedditCookie, signal?: AbortSignal): Promise<T> {- return redditCircuit.run(() => requestReddit<T>(path, cookie, signal), signal);-}--async function requestReddit<T>(path: string, cookie: RedditCookie, signal?: AbortSignal): Promise<T> {- const headers: Record<string, string> = { 'User-Agent': USER_AGENT, 'Accept': 'application/json' };- if (cookie) headers['Cookie'] = `reddit_session=${cookie}`;- let res: Response;- try {- res = await fetch(`${REDDIT_BASE}${path}`, { headers, signal });- } catch (err) {- if (isAbortError(err)) throw new UpstreamTimeoutError('Reddit', err);- throw new UpstreamError(`Reddit could not be reached (${(err as Error).message})`, { reason: 'unreachable', cause: err });- }-- if (res.status === 404) throw new NotFoundError('Reddit user not found - check the username');- if (res.status === 403) throw new UpstreamError('Session cookie is invalid or expired - open reddit.com in your browser, copy a fresh reddit_session value from DevTools (Application > Cookies > reddit.com), delete this account, and re-add it', { status: 403 });- if (res.status === 429) throw new UpstreamError('Reddit rate limit hit - try again in a moment', { status: 429 });- if (!res.ok) throw new UpstreamError(`Reddit API ${res.status}: ${res.statusText}`, { status: res.status });-- const data = await res.json() as T & RedditApiError;- if (data.error) throw new UpstreamError(data.message || 'Reddit API error');- return data;-}--export async function fetchRedditProfile(username: string, cookie: RedditCookie, signal?: AbortSignal): Promise<RedditProfile> {- const data = await redditFetch<RedditThing<RedditApiUser>>(`/user/${username}/about.json`, cookie, signal);- const user = data.data;- return {- username: user.name,- totalKarma: user.total_karma ?? ((user.link_karma ?? 0) + (user.comment_karma ?? 0)),- postKarma: user.link_karma ?? 0,- commentKarma: user.comment_karma ?? 0,- awardeeKarma: user.awardee_karma ?? 0,- awarderKarma: user.awarder_karma ?? 0,- iconUrl: (user.icon_img || user.snoovatar_img || '').replace(/&/g, '&'),- createdAt: user.created_utc ? new Date(user.created_utc * 1000).toISOString() : '',- isGold: user.is_gold ?? false,- isMod: user.is_mod ?? false,- verified: user.verified ?? false,- };-}--function redditMediaType(post: RedditApiPost): RedditMediaType {- if (post.is_video) return 'video';- if (post.post_hint === 'image') return 'image';- if (post.is_self) return 'text';- return 'link';-}--function normalizeRedditPost(post: RedditApiPost): RedditPost {- return {- id: post.id,- title: post.title,- subreddit: post.subreddit,- subredditPrefixed: post.subreddit_name_prefixed ?? `r/${post.subreddit}`,- score: post.score ?? 0,- upvoteRatio: post.upvote_ratio ?? 0,- numComments: post.num_comments ?? 0,- url: post.url ?? '',- permalink: `https://reddit.com${post.permalink}`,- thumbnail: (post.thumbnail && post.thumbnail.startsWith('http')) ? post.thumbnail : '',- mediaType: redditMediaType(post),- isSelf: post.is_self ?? false,- isVideo: post.is_video ?? false,- isNsfw: post.over_18 ?? false,- createdAt: post.created_utc ? new Date(post.created_utc * 1000).toISOString() : '',- flair: post.link_flair_text ?? '',- awardsCount: post.total_awards_received ?? 0,- };-}--export async function fetchRedditPosts(username: string, cookie: RedditCookie, limit = 100, signal?: AbortSignal): Promise<RedditPost[]> {- const allPosts: RedditApiPost[] = [];- let after: string | null = null;- let pages = 0;-- while (pages < 10 && allPosts.length < limit) {- const query = new URLSearchParams({- limit: String(Math.min(100, limit - allPosts.length)),- sort: 'new',- });- if (after) query.set('after', after);-- const data: RedditListing<RedditApiPost> = await redditFetch<RedditListing<RedditApiPost>>(`/user/${username}/submitted.json?${query}`, cookie, signal);- const children = data.data?.children ?? [];- if (children.length === 0) break;-- for (const child of children) allPosts.push(child.data);- after = data.data?.after ?? null;- if (!after) break;- pages++;- }-- return allPosts.slice(0, limit).map(normalizeRedditPost);-}--function parseRedditPostUrl(rawUrl: string): string {- let parsedUrl: URL;- try {- parsedUrl = new URL(rawUrl);- } catch {- throw new ValidationError('Invalid URL - paste the full post link from reddit.com');- }- if (!parsedUrl.hostname.includes('reddit.com')) throw new ValidationError('Not a Reddit URL - paste a link from reddit.com');- const match = parsedUrl.pathname.match(/^(\/r\/[^/]+\/comments\/[^/]+(?:\/[^/]+)?)\/?$/);- if (!match) throw new ValidationError('Not a Reddit post URL - paste the full post link including /r/.../comments/...');- return match[1];-}--export async function fetchTrackedPostData(postUrl: string, cookie: RedditCookie, signal?: AbortSignal): Promise<RedditTrackedPostData> {- const path = parseRedditPostUrl(postUrl);- const data = await redditFetch<RedditListing<RedditApiPost>[]>(`${path}.json`, cookie, signal);- if (!Array.isArray(data) || !data[0]) throw new UpstreamError('Unexpected Reddit response - post may be deleted or private');- const post = data[0]?.data?.children?.[0]?.data;- if (!post) throw new NotFoundError('Post not found or has been deleted');- return {- postId: post.id,- title: post.title,- subreddit: post.subreddit,- subredditPrefixed: post.subreddit_name_prefixed ?? `r/${post.subreddit}`,- author: post.author ?? '[deleted]',- score: post.score ?? 0,- upvoteRatio: post.upvote_ratio ?? 0,- numComments: post.num_comments ?? 0,- permalink: `https://reddit.com${post.permalink}`,- isNsfw: post.over_18 ?? false,- createdAt: post.created_utc ? new Date(post.created_utc * 1000).toISOString() : '',- lastFetchedAt: new Date().toISOString(),- };-}diff --git a/backend/services/youtube/youtubeTrends.ts b/backend/services/youtube/youtubeTrends.tsindex 5035153..3ac8de3 100644--- a/backend/services/youtube/youtubeTrends.ts+++ b/backend/services/youtube/youtubeTrends.ts@@ -63,7 +63,7 @@ export function buildTagFrequency(videos: YouTubeVideo[]): YouTubeTagCount[] {.map(([tag, count]) => ({ tag, count }));}-// strict < unlike instagram and reddit (inclusive), to match stored analytics+// strict < unlike instagram (inclusive), to match stored analyticsexport function countRecentUploads(videos: YouTubeVideo[], now: Date): YouTubeRecentUploads {const uploadedWithin = (days: number) => videos.filter(video => (now.getTime() - new Date(video.publishedAt).getTime()) < days * DAY_MS).length;return {diff --git a/backend/tests/fixtures/accountsRoutes.addInstagram.golden.json b/backend/tests/fixtures/accountsRoutes.addInstagram.golden.jsonindex ba6dbda..814a063 100644--- a/backend/tests/fixtures/accountsRoutes.addInstagram.golden.json+++ b/backend/tests/fixtures/accountsRoutes.addInstagram.golden.json@@ -72,6 +72,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -108,6 +116,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -144,6 +160,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -155,6 +179,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]}diff --git a/backend/tests/fixtures/accountsRoutes.addYouTube.golden.json b/backend/tests/fixtures/accountsRoutes.addYouTube.golden.jsonindex 767abb2..5defcc8 100644--- a/backend/tests/fixtures/accountsRoutes.addYouTube.golden.json+++ b/backend/tests/fixtures/accountsRoutes.addYouTube.golden.json@@ -56,6 +56,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -102,6 +110,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -113,6 +129,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]}diff --git a/backend/tests/fixtures/accountsRoutes.delete.golden.json b/backend/tests/fixtures/accountsRoutes.delete.golden.jsonindex d316a3c..83213a3 100644--- a/backend/tests/fixtures/accountsRoutes.delete.golden.json+++ b/backend/tests/fixtures/accountsRoutes.delete.golden.json@@ -9,8 +9,8 @@"body": "{\"success\":false,\"code\":\"NOT_FOUND\",\"message\":\"Account not found\",\"requestId\":\"req-test\"}"},{- "status": 200,- "body": "{\"success\":true}"+ "status": 404,+ "body": "{\"success\":false,\"code\":\"NOT_FOUND\",\"message\":\"Account not found\",\"requestId\":\"req-test\"}"},{"status": 200,@@ -32,6 +32,14 @@"id","nope"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -47,6 +55,14 @@"id","other"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -63,18 +79,12 @@"old1"],[- "user_id",- "user-1"- ]- ]- },- {- "type": "delete",- "table": "accounts",- "filters": [- [- "id",- "old1"+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"],["user_id",@@ -82,21 +92,6 @@]]},- {- "type": "insert",- "table": "audit_events",- "values": {- "id": "00000000-0000-4000-8000-000000000001",- "user_id": "user-1",- "action": "account.removed",- "subject_type": "account",- "subject_id": "old1",- "details": {- "platform": "retired"- }- },- "filters": []- },{"type": "select","table": "accounts",@@ -106,6 +101,14 @@"id","yt2"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -130,7 +133,7 @@"type": "insert","table": "audit_events","values": {- "id": "00000000-0000-4000-8000-000000000002",+ "id": "00000000-0000-4000-8000-000000000001","user_id": "user-1","action": "account.removed","subject_type": "account",@@ -149,17 +152,21 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]}],"redis": [- "videos:user-1:old1",- "ig:user-1:old1",- "reddit:user-1:old1","videos:user-1:yt2",- "ig:user-1:yt2",- "reddit:user-1:yt2"+ "ig:user-1:yt2"],"logs": []}diff --git a/backend/tests/fixtures/accountsRoutes.listResolve.golden.json b/backend/tests/fixtures/accountsRoutes.listResolve.golden.jsonindex f4df467..248e6d0 100644--- a/backend/tests/fixtures/accountsRoutes.listResolve.golden.json+++ b/backend/tests/fixtures/accountsRoutes.listResolve.golden.json@@ -2,7 +2,7 @@"responses": [{"status": 200,- "body": "[{\"id\":\"yt1\",\"platform\":\"youtube\",\"channelId\":\"UCaaaaaaaaaaaaaaaaaaaaaa\",\"title\":\"Old title\",\"subscriberCount\":1,\"hasCookie\":false},{\"id\":\"ig1\",\"platform\":\"instagram\",\"igUserId\":\"1789\",\"username\":\"ribbon\",\"tokenExpiresAt\":\"2026-09-05T00:00:00.000Z\",\"followersCount\":1,\"hasCookie\":false},{\"id\":\"ig2\",\"platform\":\"instagram\",\"igUserId\":\"2000\",\"username\":\"notoken\",\"hasCookie\":false},{\"id\":\"old1\",\"platform\":\"retired\",\"username\":\"old_profile\",\"hasCookie\":false},{\"id\":\"yt2\",\"platform\":\"youtube\",\"channelId\":\"UCmissingmissingmissing0\",\"hasCookie\":false}]"+ "body": "[{\"id\":\"yt1\",\"platform\":\"youtube\",\"channelId\":\"UCaaaaaaaaaaaaaaaaaaaaaa\",\"title\":\"Old title\",\"subscriberCount\":1,\"hasCookie\":false},{\"id\":\"ig1\",\"platform\":\"instagram\",\"igUserId\":\"1789\",\"username\":\"ribbon\",\"tokenExpiresAt\":\"2026-09-05T00:00:00.000Z\",\"followersCount\":1,\"hasCookie\":false},{\"id\":\"ig2\",\"platform\":\"instagram\",\"igUserId\":\"2000\",\"username\":\"notoken\",\"hasCookie\":false},{\"id\":\"yt2\",\"platform\":\"youtube\",\"channelId\":\"UCmissingmissingmissing0\",\"hasCookie\":false}]"},{"status": 200,@@ -44,6 +44,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]}diff --git a/backend/tests/fixtures/accountsRoutes.refreshAll.golden.json b/backend/tests/fixtures/accountsRoutes.refreshAll.golden.jsonindex 604a048..040f24c 100644--- a/backend/tests/fixtures/accountsRoutes.refreshAll.golden.json+++ b/backend/tests/fixtures/accountsRoutes.refreshAll.golden.json@@ -2,15 +2,15 @@"responses": [{"status": 200,- "body": "{\"success\":true,\"accounts\":[{\"id\":\"yt1\",\"platform\":\"youtube\",\"channelId\":\"UCaaaaaaaaaaaaaaaaaaaaaa\",\"title\":\"Channel UCaa\",\"subscriberCount\":500,\"lastUpdated\":\"2026-09-01T12:00:00.000Z\",\"viewCount\":9000,\"videoCount\":12,\"thumbnails\":{\"default\":\"d\",\"medium\":\"m\",\"high\":\"h\"},\"hasCookie\":false},{\"id\":\"ig1\",\"platform\":\"instagram\",\"igUserId\":\"1789\",\"username\":\"ribbon\",\"tokenExpiresAt\":\"2026-09-05T00:00:00.000Z\",\"followersCount\":2500,\"lastUpdated\":\"2026-09-01T12:00:00.000Z\",\"followsCount\":10,\"mediaCount\":140,\"title\":\"Ribbon\",\"profilePictureUrl\":\"https://p\",\"hasCookie\":false},{\"id\":\"ig2\",\"platform\":\"instagram\",\"igUserId\":\"2000\",\"username\":\"notoken\",\"hasCookie\":false},{\"id\":\"old1\",\"platform\":\"retired\",\"username\":\"old_profile\",\"hasCookie\":false},{\"id\":\"yt2\",\"platform\":\"youtube\",\"channelId\":\"UCmissingmissingmissing0\",\"hasCookie\":false}],\"results\":[{\"id\":\"yt1\",\"success\":true},{\"id\":\"ig1\",\"success\":true},{\"id\":\"ig2\",\"success\":false,\"error\":\"No access token stored - reconnect this Instagram account\"},{\"id\":\"old1\",\"success\":false,\"error\":\"No YouTube channel ID stored - delete this channel and add it again\"},{\"id\":\"yt2\",\"success\":false,\"error\":\"Channel not found\"}],\"updatedAt\":\"2026-09-01T12:00:00.000Z\"}"+ "body": "{\"success\":true,\"accounts\":[{\"id\":\"yt1\",\"platform\":\"youtube\",\"channelId\":\"UCaaaaaaaaaaaaaaaaaaaaaa\",\"title\":\"Channel UCaa\",\"subscriberCount\":500,\"lastUpdated\":\"2026-09-01T12:00:00.000Z\",\"viewCount\":9000,\"videoCount\":12,\"thumbnails\":{\"default\":\"d\",\"medium\":\"m\",\"high\":\"h\"},\"hasCookie\":false},{\"id\":\"ig1\",\"platform\":\"instagram\",\"igUserId\":\"1789\",\"username\":\"ribbon\",\"tokenExpiresAt\":\"2026-09-05T00:00:00.000Z\",\"followersCount\":2500,\"lastUpdated\":\"2026-09-01T12:00:00.000Z\",\"followsCount\":10,\"mediaCount\":140,\"title\":\"Ribbon\",\"profilePictureUrl\":\"https://p\",\"hasCookie\":false},{\"id\":\"ig2\",\"platform\":\"instagram\",\"igUserId\":\"2000\",\"username\":\"notoken\",\"hasCookie\":false},{\"id\":\"yt2\",\"platform\":\"youtube\",\"channelId\":\"UCmissingmissingmissing0\",\"hasCookie\":false}],\"results\":[{\"id\":\"yt1\",\"success\":true},{\"id\":\"ig1\",\"success\":true},{\"id\":\"ig2\",\"success\":false,\"error\":\"No access token stored - reconnect this Instagram account\"},{\"id\":\"yt2\",\"success\":false,\"error\":\"Channel not found\"}],\"updatedAt\":\"2026-09-01T12:00:00.000Z\"}"},{"status": 200,- "body": "{\"success\":true,\"accounts\":[{\"id\":\"yt1\",\"platform\":\"youtube\",\"channelId\":\"UCaaaaaaaaaaaaaaaaaaaaaa\",\"title\":\"Channel UCaa\",\"subscriberCount\":500,\"lastUpdated\":\"2026-09-01T12:00:00.000Z\",\"viewCount\":9000,\"videoCount\":12,\"thumbnails\":{\"default\":\"d\",\"medium\":\"m\",\"high\":\"h\"},\"hasCookie\":false},{\"id\":\"ig1\",\"platform\":\"instagram\",\"igUserId\":\"1789\",\"username\":\"ribbon\",\"tokenExpiresAt\":\"2026-09-05T00:00:00.000Z\",\"followersCount\":2500,\"lastUpdated\":\"2026-09-01T12:00:00.000Z\",\"followsCount\":10,\"mediaCount\":140,\"title\":\"Ribbon\",\"profilePictureUrl\":\"https://p\",\"hasCookie\":false},{\"id\":\"ig2\",\"platform\":\"instagram\",\"igUserId\":\"2000\",\"username\":\"notoken\",\"hasCookie\":false},{\"id\":\"old1\",\"platform\":\"retired\",\"username\":\"old_profile\",\"hasCookie\":false},{\"id\":\"yt2\",\"platform\":\"youtube\",\"channelId\":\"UCmissingmissingmissing0\",\"hasCookie\":false}],\"results\":[{\"id\":\"yt1\",\"success\":false,\"error\":\"YouTube API key not configured on server\"},{\"id\":\"ig1\",\"success\":true},{\"id\":\"ig2\",\"success\":false,\"error\":\"No access token stored - reconnect this Instagram account\"},{\"id\":\"old1\",\"success\":false,\"error\":\"No YouTube channel ID stored - delete this channel and add it again\"},{\"id\":\"yt2\",\"success\":false,\"error\":\"YouTube API key not configured on server\"}],\"updatedAt\":\"2026-09-01T12:00:00.000Z\"}"+ "body": "{\"success\":true,\"accounts\":[{\"id\":\"yt1\",\"platform\":\"youtube\",\"channelId\":\"UCaaaaaaaaaaaaaaaaaaaaaa\",\"title\":\"Channel UCaa\",\"subscriberCount\":500,\"lastUpdated\":\"2026-09-01T12:00:00.000Z\",\"viewCount\":9000,\"videoCount\":12,\"thumbnails\":{\"default\":\"d\",\"medium\":\"m\",\"high\":\"h\"},\"hasCookie\":false},{\"id\":\"ig1\",\"platform\":\"instagram\",\"igUserId\":\"1789\",\"username\":\"ribbon\",\"tokenExpiresAt\":\"2026-09-05T00:00:00.000Z\",\"followersCount\":2500,\"lastUpdated\":\"2026-09-01T12:00:00.000Z\",\"followsCount\":10,\"mediaCount\":140,\"title\":\"Ribbon\",\"profilePictureUrl\":\"https://p\",\"hasCookie\":false},{\"id\":\"ig2\",\"platform\":\"instagram\",\"igUserId\":\"2000\",\"username\":\"notoken\",\"hasCookie\":false},{\"id\":\"yt2\",\"platform\":\"youtube\",\"channelId\":\"UCmissingmissingmissing0\",\"hasCookie\":false}],\"results\":[{\"id\":\"yt1\",\"success\":false,\"error\":\"YouTube API key not configured on server\"},{\"id\":\"ig1\",\"success\":true},{\"id\":\"ig2\",\"success\":false,\"error\":\"No access token stored - reconnect this Instagram account\"},{\"id\":\"yt2\",\"success\":false,\"error\":\"YouTube API key not configured on server\"}],\"updatedAt\":\"2026-09-01T12:00:00.000Z\"}"},{"status": 200,- "body": "{\"success\":true,\"accounts\":[{\"id\":\"yt1\",\"platform\":\"youtube\",\"channelId\":\"UCaaaaaaaaaaaaaaaaaaaaaa\",\"title\":\"Channel UCaa\",\"subscriberCount\":500,\"lastUpdated\":\"2026-09-01T12:00:00.000Z\",\"viewCount\":9000,\"videoCount\":12,\"thumbnails\":{\"default\":\"d\",\"medium\":\"m\",\"high\":\"h\"},\"hasCookie\":false},{\"id\":\"ig1\",\"platform\":\"instagram\",\"igUserId\":\"1789\",\"username\":\"ribbon\",\"tokenExpiresAt\":\"2026-09-05T00:00:00.000Z\",\"followersCount\":2500,\"lastUpdated\":\"2026-09-01T12:00:00.000Z\",\"followsCount\":10,\"mediaCount\":140,\"title\":\"Ribbon\",\"profilePictureUrl\":\"https://p\",\"hasCookie\":false},{\"id\":\"ig2\",\"platform\":\"instagram\",\"igUserId\":\"2000\",\"username\":\"notoken\",\"hasCookie\":false},{\"id\":\"old1\",\"platform\":\"retired\",\"username\":\"old_profile\",\"hasCookie\":false},{\"id\":\"yt2\",\"platform\":\"youtube\",\"channelId\":\"UCmissingmissingmissing0\",\"hasCookie\":false}],\"results\":[{\"id\":\"yt1\",\"success\":true},{\"id\":\"ig1\",\"success\":true},{\"id\":\"ig2\",\"success\":false,\"error\":\"No access token stored - reconnect this Instagram account\"},{\"id\":\"old1\",\"success\":false,\"error\":\"No YouTube channel ID stored - delete this channel and add it again\"},{\"id\":\"yt2\",\"success\":false,\"error\":\"Channel not found\"}],\"updatedAt\":\"2026-09-01T12:00:00.000Z\"}"+ "body": "{\"success\":true,\"accounts\":[{\"id\":\"yt1\",\"platform\":\"youtube\",\"channelId\":\"UCaaaaaaaaaaaaaaaaaaaaaa\",\"title\":\"Channel UCaa\",\"subscriberCount\":500,\"lastUpdated\":\"2026-09-01T12:00:00.000Z\",\"viewCount\":9000,\"videoCount\":12,\"thumbnails\":{\"default\":\"d\",\"medium\":\"m\",\"high\":\"h\"},\"hasCookie\":false},{\"id\":\"ig1\",\"platform\":\"instagram\",\"igUserId\":\"1789\",\"username\":\"ribbon\",\"tokenExpiresAt\":\"2026-09-05T00:00:00.000Z\",\"followersCount\":2500,\"lastUpdated\":\"2026-09-01T12:00:00.000Z\",\"followsCount\":10,\"mediaCount\":140,\"title\":\"Ribbon\",\"profilePictureUrl\":\"https://p\",\"hasCookie\":false},{\"id\":\"ig2\",\"platform\":\"instagram\",\"igUserId\":\"2000\",\"username\":\"notoken\",\"hasCookie\":false},{\"id\":\"yt2\",\"platform\":\"youtube\",\"channelId\":\"UCmissingmissingmissing0\",\"hasCookie\":false}],\"results\":[{\"id\":\"yt1\",\"success\":true},{\"id\":\"ig1\",\"success\":true},{\"id\":\"ig2\",\"success\":false,\"error\":\"No access token stored - reconnect this Instagram account\"},{\"id\":\"yt2\",\"success\":false,\"error\":\"Channel not found\"}],\"updatedAt\":\"2026-09-01T12:00:00.000Z\"}"}],"requests": [@@ -52,6 +52,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -102,6 +110,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -113,6 +129,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -142,6 +166,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -153,6 +185,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -203,6 +243,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]}diff --git a/backend/tests/fixtures/accountsRoutes.refreshOne.golden.json b/backend/tests/fixtures/accountsRoutes.refreshOne.golden.jsonindex 72f6447..3ba2961 100644--- a/backend/tests/fixtures/accountsRoutes.refreshOne.golden.json+++ b/backend/tests/fixtures/accountsRoutes.refreshOne.golden.json@@ -13,8 +13,8 @@"body": "{\"success\":false,\"code\":\"VALIDATION_ERROR\",\"message\":\"No access token stored - reconnect this Instagram account\",\"requestId\":\"req-test\"}"},{- "status": 400,- "body": "{\"success\":false,\"code\":\"VALIDATION_ERROR\",\"message\":\"No YouTube channel ID stored - delete this channel and add it again\",\"requestId\":\"req-test\"}"+ "status": 404,+ "body": "{\"success\":false,\"code\":\"NOT_FOUND\",\"message\":\"Account not found\",\"requestId\":\"req-test\"}"},{"status": 200,@@ -85,6 +85,14 @@"id","nope"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -100,6 +108,14 @@"id","ig1"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -135,6 +151,14 @@"id","ig2"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -150,6 +174,14 @@"id","old1"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -165,6 +197,14 @@"id","yt1"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -208,6 +248,14 @@"id","yt1"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -223,6 +271,14 @@"id","yt2"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -238,6 +294,14 @@"id","other"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -253,6 +317,14 @@"id","nope"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -268,6 +340,14 @@"id","yt1"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -283,6 +363,14 @@"id","ig2"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -298,6 +386,14 @@"id","ig1"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -326,6 +422,14 @@"id","ig1"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"diff --git a/backend/tests/fixtures/analyticsRoutes.youtube.golden.json b/backend/tests/fixtures/analyticsRoutes.youtube.golden.jsonindex 10f31ea..2f9f1eb 100644--- a/backend/tests/fixtures/analyticsRoutes.youtube.golden.json+++ b/backend/tests/fixtures/analyticsRoutes.youtube.golden.json@@ -9,22 +9,22 @@{"call": "GET /videos/all","status": 200,- "body": "{\"success\":true,\"videos\":[{\"videoId\":\"b\",\"title\":\"Travel diary\",\"tags\":[\"Trip\",\"pasta\"],\"viewCount\":50,\"likeCount\":null,\"commentCount\":4,\"publishedAt\":\"2026-02-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"},{\"videoId\":\"c\",\"title\":\"Zebra facts\",\"viewCount\":300,\"likeCount\":2,\"commentCount\":1,\"publishedAt\":\"2025-12-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"},{\"videoId\":\"d\",\"title\":\"Another pasta\",\"tags\":[],\"viewCount\":300,\"likeCount\":1,\"commentCount\":1,\"publishedAt\":\"2026-03-01T00:00:00Z\",\"channelTitle\":\"Beta\",\"channelId\":\"yt2\",\"channelThumbnail\":\"\"},{\"videoId\":\"a\",\"title\":\"Cooking pasta\",\"tags\":[\"food\"],\"viewCount\":900,\"likeCount\":10,\"commentCount\":null,\"publishedAt\":\"2026-01-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"}],\"total\":4,\"channels\":[{\"id\":\"yt1\",\"title\":\"Alpha\"},{\"id\":\"yt2\",\"title\":\"Beta\"},{\"id\":\"yt3\",\"title\":\"Gamma\"},{\"id\":\"ig1\"},{\"id\":\"rd1\"},{\"id\":\"rd2\"}]}"+ "body": "{\"success\":true,\"videos\":[{\"videoId\":\"b\",\"title\":\"Travel diary\",\"tags\":[\"Trip\",\"pasta\"],\"viewCount\":50,\"likeCount\":null,\"commentCount\":4,\"publishedAt\":\"2026-02-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"},{\"videoId\":\"c\",\"title\":\"Zebra facts\",\"viewCount\":300,\"likeCount\":2,\"commentCount\":1,\"publishedAt\":\"2025-12-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"},{\"videoId\":\"d\",\"title\":\"Another pasta\",\"tags\":[],\"viewCount\":300,\"likeCount\":1,\"commentCount\":1,\"publishedAt\":\"2026-03-01T00:00:00Z\",\"channelTitle\":\"Beta\",\"channelId\":\"yt2\",\"channelThumbnail\":\"\"},{\"videoId\":\"a\",\"title\":\"Cooking pasta\",\"tags\":[\"food\"],\"viewCount\":900,\"likeCount\":10,\"commentCount\":null,\"publishedAt\":\"2026-01-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"}],\"total\":4,\"channels\":[{\"id\":\"yt1\",\"title\":\"Alpha\"},{\"id\":\"yt2\",\"title\":\"Beta\"},{\"id\":\"yt3\",\"title\":\"Gamma\"},{\"id\":\"ig1\"}]}"},{"call": "GET /videos/all?search=PASTA&sort=title&order=asc","status": 200,- "body": "{\"success\":true,\"videos\":[{\"videoId\":\"d\",\"title\":\"Another pasta\",\"tags\":[],\"viewCount\":300,\"likeCount\":1,\"commentCount\":1,\"publishedAt\":\"2026-03-01T00:00:00Z\",\"channelTitle\":\"Beta\",\"channelId\":\"yt2\",\"channelThumbnail\":\"\"},{\"videoId\":\"a\",\"title\":\"Cooking pasta\",\"tags\":[\"food\"],\"viewCount\":900,\"likeCount\":10,\"commentCount\":null,\"publishedAt\":\"2026-01-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"},{\"videoId\":\"b\",\"title\":\"Travel diary\",\"tags\":[\"Trip\",\"pasta\"],\"viewCount\":50,\"likeCount\":null,\"commentCount\":4,\"publishedAt\":\"2026-02-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"}],\"total\":3,\"channels\":[{\"id\":\"yt1\",\"title\":\"Alpha\"},{\"id\":\"yt2\",\"title\":\"Beta\"},{\"id\":\"yt3\",\"title\":\"Gamma\"},{\"id\":\"ig1\"},{\"id\":\"rd1\"},{\"id\":\"rd2\"}]}"+ "body": "{\"success\":true,\"videos\":[{\"videoId\":\"d\",\"title\":\"Another pasta\",\"tags\":[],\"viewCount\":300,\"likeCount\":1,\"commentCount\":1,\"publishedAt\":\"2026-03-01T00:00:00Z\",\"channelTitle\":\"Beta\",\"channelId\":\"yt2\",\"channelThumbnail\":\"\"},{\"videoId\":\"a\",\"title\":\"Cooking pasta\",\"tags\":[\"food\"],\"viewCount\":900,\"likeCount\":10,\"commentCount\":null,\"publishedAt\":\"2026-01-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"},{\"videoId\":\"b\",\"title\":\"Travel diary\",\"tags\":[\"Trip\",\"pasta\"],\"viewCount\":50,\"likeCount\":null,\"commentCount\":4,\"publishedAt\":\"2026-02-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"}],\"total\":3,\"channels\":[{\"id\":\"yt1\",\"title\":\"Alpha\"},{\"id\":\"yt2\",\"title\":\"Beta\"},{\"id\":\"yt3\",\"title\":\"Gamma\"},{\"id\":\"ig1\"}]}"},{"call": "GET /videos/all?channelId=yt1&minViews=100&maxViews=899","status": 200,- "body": "{\"success\":true,\"videos\":[{\"videoId\":\"c\",\"title\":\"Zebra facts\",\"viewCount\":300,\"likeCount\":2,\"commentCount\":1,\"publishedAt\":\"2025-12-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"}],\"total\":1,\"channels\":[{\"id\":\"yt1\",\"title\":\"Alpha\"},{\"id\":\"yt2\",\"title\":\"Beta\"},{\"id\":\"yt3\",\"title\":\"Gamma\"},{\"id\":\"ig1\"},{\"id\":\"rd1\"},{\"id\":\"rd2\"}]}"+ "body": "{\"success\":true,\"videos\":[{\"videoId\":\"c\",\"title\":\"Zebra facts\",\"viewCount\":300,\"likeCount\":2,\"commentCount\":1,\"publishedAt\":\"2025-12-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"}],\"total\":1,\"channels\":[{\"id\":\"yt1\",\"title\":\"Alpha\"},{\"id\":\"yt2\",\"title\":\"Beta\"},{\"id\":\"yt3\",\"title\":\"Gamma\"},{\"id\":\"ig1\"}]}"},{"call": "GET /videos/all?sort=likeCount","status": 200,- "body": "{\"success\":true,\"videos\":[{\"videoId\":\"b\",\"title\":\"Travel diary\",\"tags\":[\"Trip\",\"pasta\"],\"viewCount\":50,\"likeCount\":null,\"commentCount\":4,\"publishedAt\":\"2026-02-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"},{\"videoId\":\"d\",\"title\":\"Another pasta\",\"tags\":[],\"viewCount\":300,\"likeCount\":1,\"commentCount\":1,\"publishedAt\":\"2026-03-01T00:00:00Z\",\"channelTitle\":\"Beta\",\"channelId\":\"yt2\",\"channelThumbnail\":\"\"},{\"videoId\":\"c\",\"title\":\"Zebra facts\",\"viewCount\":300,\"likeCount\":2,\"commentCount\":1,\"publishedAt\":\"2025-12-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"},{\"videoId\":\"a\",\"title\":\"Cooking pasta\",\"tags\":[\"food\"],\"viewCount\":900,\"likeCount\":10,\"commentCount\":null,\"publishedAt\":\"2026-01-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"}],\"total\":4,\"channels\":[{\"id\":\"yt1\",\"title\":\"Alpha\"},{\"id\":\"yt2\",\"title\":\"Beta\"},{\"id\":\"yt3\",\"title\":\"Gamma\"},{\"id\":\"ig1\"},{\"id\":\"rd1\"},{\"id\":\"rd2\"}]}"+ "body": "{\"success\":true,\"videos\":[{\"videoId\":\"b\",\"title\":\"Travel diary\",\"tags\":[\"Trip\",\"pasta\"],\"viewCount\":50,\"likeCount\":null,\"commentCount\":4,\"publishedAt\":\"2026-02-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"},{\"videoId\":\"d\",\"title\":\"Another pasta\",\"tags\":[],\"viewCount\":300,\"likeCount\":1,\"commentCount\":1,\"publishedAt\":\"2026-03-01T00:00:00Z\",\"channelTitle\":\"Beta\",\"channelId\":\"yt2\",\"channelThumbnail\":\"\"},{\"videoId\":\"c\",\"title\":\"Zebra facts\",\"viewCount\":300,\"likeCount\":2,\"commentCount\":1,\"publishedAt\":\"2025-12-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"},{\"videoId\":\"a\",\"title\":\"Cooking pasta\",\"tags\":[\"food\"],\"viewCount\":900,\"likeCount\":10,\"commentCount\":null,\"publishedAt\":\"2026-01-01T00:00:00Z\",\"channelTitle\":\"Alpha\",\"channelId\":\"yt1\",\"channelThumbnail\":\"a.jpg\"}],\"total\":4,\"channels\":[{\"id\":\"yt1\",\"title\":\"Alpha\"},{\"id\":\"yt2\",\"title\":\"Beta\"},{\"id\":\"yt3\",\"title\":\"Gamma\"},{\"id\":\"ig1\"}]}"},{"call": "GET /accounts/yt1/analytics",@@ -56,6 +56,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -67,6 +75,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -78,6 +94,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -89,6 +113,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -100,6 +132,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -112,6 +152,14 @@"id","yt1"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -127,6 +175,14 @@"id","yt2"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -142,6 +198,14 @@"id","yt3"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"@@ -157,6 +221,14 @@"id","missing"],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"+ ],["user_id","user-1"diff --git a/backend/tests/fixtures/instagramAuth.callback.golden.json b/backend/tests/fixtures/instagramAuth.callback.golden.jsonindex e41d937..7682ddc 100644--- a/backend/tests/fixtures/instagramAuth.callback.golden.json+++ b/backend/tests/fixtures/instagramAuth.callback.golden.json@@ -170,6 +170,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -221,6 +229,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -272,6 +288,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},diff --git a/backend/tests/fixtures/overviewRoutes.summary.golden.json b/backend/tests/fixtures/overviewRoutes.summary.golden.jsonindex f58a8b3..84c8f2f 100644--- a/backend/tests/fixtures/overviewRoutes.summary.golden.json+++ b/backend/tests/fixtures/overviewRoutes.summary.golden.json@@ -4,7 +4,7 @@{"call": "GET /overview","status": 200,- "body": "{\"tracked\":[{\"id\":\"t1\",\"url\":\"https://youtu.be/x\",\"label\":\"\",\"category\":\"\",\"contentType\":\"youtube\",\"createdAt\":\"2026-08-01T00:00:00Z\",\"updatedAt\":\"2026-08-01T00:00:00Z\",\"title\":\"Tracked\"}],\"analyticsCache\":{\"yt1\":{\"id\":\"yt1\",\"cacheWarmed\":true,\"totalLikes\":12,\"totalComments\":5,\"fetchedAt\":\"then\"},\"yt2\":{\"id\":\"yt2\",\"cacheWarmed\":true,\"totalLikes\":1,\"totalComments\":1,\"fetchedAt\":\"then\"},\"yt3\":{\"id\":\"yt3\",\"cacheWarmed\":false,\"syncing\":false},\"ig1\":{\"id\":\"ig1\",\"cacheWarmed\":true,\"totalLikes\":6,\"totalComments\":2,\"totalViews\":90,\"contentTypes\":{\"reel\":{\"count\":1,\"likes\":5,\"comments\":2,\"views\":90,\"viewsReported\":1},\"post\":{\"count\":1,\"likes\":1,\"comments\":0,\"views\":0,\"viewsReported\":0},\"video\":{\"count\":0,\"likes\":0,\"comments\":0,\"views\":0,\"viewsReported\":0}}},\"rd1\":{\"id\":\"rd1\",\"cacheWarmed\":true,\"fetchedPosts\":4,\"totalScore\":40,\"totalComments\":0},\"rd2\":{\"id\":\"rd2\",\"cacheWarmed\":false,\"syncing\":false}}}"+ "body": "{\"tracked\":[{\"id\":\"t1\",\"url\":\"https://youtu.be/x\",\"label\":\"\",\"category\":\"\",\"contentType\":\"youtube\",\"createdAt\":\"2026-08-01T00:00:00Z\",\"updatedAt\":\"2026-08-01T00:00:00Z\",\"title\":\"Tracked\"}],\"analyticsCache\":{\"yt1\":{\"id\":\"yt1\",\"cacheWarmed\":true,\"totalLikes\":12,\"totalComments\":5,\"fetchedAt\":\"then\"},\"yt2\":{\"id\":\"yt2\",\"cacheWarmed\":true,\"totalLikes\":1,\"totalComments\":1,\"fetchedAt\":\"then\"},\"yt3\":{\"id\":\"yt3\",\"cacheWarmed\":false,\"syncing\":false},\"ig1\":{\"id\":\"ig1\",\"cacheWarmed\":true,\"totalLikes\":6,\"totalComments\":2,\"totalViews\":90,\"contentTypes\":{\"reel\":{\"count\":1,\"likes\":5,\"comments\":2,\"views\":90,\"viewsReported\":1},\"post\":{\"count\":1,\"likes\":1,\"comments\":0,\"views\":0,\"viewsReported\":0},\"video\":{\"count\":0,\"likes\":0,\"comments\":0,\"views\":0,\"viewsReported\":0}}}}}"}],"queries": [@@ -16,6 +16,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -44,7 +52,7 @@{"call": "GET /overview","status": 200,- "body": "{\"tracked\":[{\"id\":\"t1\",\"url\":\"https://youtu.be/x\",\"label\":\"\",\"category\":\"\",\"contentType\":\"youtube\",\"createdAt\":\"2026-08-01T00:00:00Z\",\"updatedAt\":\"2026-08-01T00:00:00Z\",\"title\":\"Tracked\"}],\"analyticsCache\":{\"yt1\":{\"id\":\"yt1\",\"cacheWarmed\":false,\"syncing\":false},\"yt2\":{\"id\":\"yt2\",\"cacheWarmed\":false,\"syncing\":false},\"yt3\":{\"id\":\"yt3\",\"cacheWarmed\":false,\"syncing\":false},\"ig1\":{\"id\":\"ig1\",\"cacheWarmed\":false,\"syncing\":false},\"rd1\":{\"id\":\"rd1\",\"cacheWarmed\":false,\"syncing\":false},\"rd2\":{\"id\":\"rd2\",\"cacheWarmed\":false,\"syncing\":false}}}"+ "body": "{\"tracked\":[{\"id\":\"t1\",\"url\":\"https://youtu.be/x\",\"label\":\"\",\"category\":\"\",\"contentType\":\"youtube\",\"createdAt\":\"2026-08-01T00:00:00Z\",\"updatedAt\":\"2026-08-01T00:00:00Z\",\"title\":\"Tracked\"}],\"analyticsCache\":{\"yt1\":{\"id\":\"yt1\",\"cacheWarmed\":false,\"syncing\":false},\"yt2\":{\"id\":\"yt2\",\"cacheWarmed\":false,\"syncing\":false},\"yt3\":{\"id\":\"yt3\",\"cacheWarmed\":false,\"syncing\":false},\"ig1\":{\"id\":\"ig1\",\"cacheWarmed\":false,\"syncing\":false}}}"}],"queries": [@@ -56,6 +64,14 @@["user_id","user-1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},diff --git a/backend/tests/fixtures/overviewRoutes.warming.golden.json b/backend/tests/fixtures/overviewRoutes.warming.golden.jsonindex 99cb821..f8b4904 100644--- a/backend/tests/fixtures/overviewRoutes.warming.golden.json+++ b/backend/tests/fixtures/overviewRoutes.warming.golden.json@@ -1,6 +1,6 @@{"status": 200,- "body": "{\"tracked\":[{\"id\":\"t1\",\"url\":\"https://youtu.be/x\",\"label\":\"\",\"category\":\"\",\"contentType\":\"youtube\",\"createdAt\":\"2026-08-01T00:00:00Z\",\"updatedAt\":\"2026-08-01T00:00:00Z\",\"title\":\"Tracked\"}],\"analyticsCache\":{\"yt1\":{\"id\":\"yt1\",\"cacheWarmed\":false,\"syncing\":true},\"yt2\":{\"id\":\"yt2\",\"cacheWarmed\":false,\"syncing\":true},\"yt3\":{\"id\":\"yt3\",\"cacheWarmed\":false,\"syncing\":false},\"ig1\":{\"id\":\"ig1\",\"cacheWarmed\":false,\"syncing\":true},\"rd1\":{\"id\":\"rd1\",\"cacheWarmed\":false,\"syncing\":true},\"rd2\":{\"id\":\"rd2\",\"cacheWarmed\":false,\"syncing\":false}}}",+ "body": "{\"tracked\":[{\"id\":\"t1\",\"url\":\"https://youtu.be/x\",\"label\":\"\",\"category\":\"\",\"contentType\":\"youtube\",\"createdAt\":\"2026-08-01T00:00:00Z\",\"updatedAt\":\"2026-08-01T00:00:00Z\",\"title\":\"Tracked\"}],\"analyticsCache\":{\"yt1\":{\"id\":\"yt1\",\"cacheWarmed\":false,\"syncing\":true},\"yt2\":{\"id\":\"yt2\",\"cacheWarmed\":false,\"syncing\":true},\"yt3\":{\"id\":\"yt3\",\"cacheWarmed\":false,\"syncing\":false},\"ig1\":{\"id\":\"ig1\",\"cacheWarmed\":false,\"syncing\":true}}}","waitUntilCalls": 1,"settled": [[@@ -12,10 +12,6 @@"status": "fulfilled","value": "[undefined]"},- {- "status": "fulfilled",- "value": "[undefined]"- },{"status": "fulfilled","value": "[undefined]"@@ -34,24 +30,6 @@{"url": "https://graph.instagram.com/v25.0/IG1/media?access_token=T1&limit=50&fields=id%2Ccaption%2Cmedia_type%2Cmedia_product_type%2Cmedia_url%2Cthumbnail_url%2Ccover_url%2Cpermalink%2Ctimestamp%2Clike_count%2Ccomments_count%2Cinsights.metric%28views%29","method": "GET"- },- {- "url": "https://www.reddit.com/user/ribbon/about.json",- "method": "GET",- "headers": {- "User-Agent": "script:twiligent:v1.0 (by /u/spacesdrive)",- "Accept": "application/json",- "Cookie": "reddit_session=COOKIE"- }- },- {- "url": "https://www.reddit.com/user/ribbon/submitted.json?limit=100&sort=new",- "method": "GET",- "headers": {- "User-Agent": "script:twiligent:v1.0 (by /u/spacesdrive)",- "Accept": "application/json",- "Cookie": "reddit_session=COOKIE"- }}],"redisWrites": [diff --git a/backend/tests/fixtures/reddit.errors.golden.json b/backend/tests/fixtures/reddit.errors.golden.jsondeleted file mode 100644index 0040626..0000000--- a/backend/tests/fixtures/reddit.errors.golden.json+++ /dev/null@@ -1,20 +0,0 @@-[- {- "error": "Reddit user not found - check the username"- },- {- "error": "Session cookie is invalid or expired - open reddit.com in your browser, copy a fresh reddit_session value from DevTools (Application > Cookies > reddit.com), delete this account, and re-add it"- },- {- "error": "Reddit rate limit hit - try again in a moment"- },- {- "error": "Reddit API 500: Server Error"- },- {- "error": "Bad request"- },- {- "error": "Reddit API error"- }-]diff --git a/backend/tests/fixtures/reddit.posts.golden.json b/backend/tests/fixtures/reddit.posts.golden.jsondeleted file mode 100644index ebe7447..0000000--- a/backend/tests/fixtures/reddit.posts.golden.json+++ /dev/null@@ -1,177 +0,0 @@-{- "posts": [- {- "id": "a",- "title": "Self post",- "subreddit": "webdev",- "subredditPrefixed": "r/webdev",- "score": 10,- "upvoteRatio": 0.9,- "numComments": 3,- "url": "https://reddit.com/a",- "permalink": "https://reddit.com/r/webdev/comments/a/self/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-07-25T17:20:00.000Z",- "flair": "Discussion",- "awardsCount": 1- },- {- "id": "b",- "title": "Video",- "subreddit": "videos",- "subredditPrefixed": "r/videos",- "score": 0,- "upvoteRatio": 0,- "numComments": 0,- "url": "",- "permalink": "https://reddit.com/r/videos/comments/b/v/",- "thumbnail": "https://thumb/b.jpg",- "mediaType": "video",- "isSelf": false,- "isVideo": true,- "isNsfw": true,- "createdAt": "2026-07-26T21:06:40.500Z",- "flair": "",- "awardsCount": 0- },- {- "id": "c",- "title": "Image",- "subreddit": "pics",- "subredditPrefixed": "r/pics",- "score": 0,- "upvoteRatio": 0,- "numComments": 0,- "url": "",- "permalink": "https://reddit.com/r/pics/comments/c/i/",- "thumbnail": "",- "mediaType": "image",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "",- "flair": "",- "awardsCount": 0- },- {- "id": "d",- "title": "Link",- "subreddit": "news",- "subredditPrefixed": "r/news",- "score": 0,- "upvoteRatio": 0,- "numComments": 0,- "url": "",- "permalink": "https://reddit.com/r/news/comments/d/l/",- "thumbnail": "",- "mediaType": "link",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "",- "flair": "",- "awardsCount": 0- },- {- "id": "e",- "title": "Bare",- "subreddit": "misc",- "subredditPrefixed": "r/misc",- "score": 0,- "upvoteRatio": 0,- "numComments": 0,- "url": "",- "permalink": "https://reddit.com/r/misc/comments/e/b/",- "thumbnail": "",- "mediaType": "link",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "",- "flair": "",- "awardsCount": 0- }- ],- "limited": [- {- "id": "a",- "title": "Self post",- "subreddit": "webdev",- "subredditPrefixed": "r/webdev",- "score": 10,- "upvoteRatio": 0.9,- "numComments": 3,- "url": "https://reddit.com/a",- "permalink": "https://reddit.com/r/webdev/comments/a/self/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-07-25T17:20:00.000Z",- "flair": "Discussion",- "awardsCount": 1- },- {- "id": "b",- "title": "Video",- "subreddit": "videos",- "subredditPrefixed": "r/videos",- "score": 0,- "upvoteRatio": 0,- "numComments": 0,- "url": "",- "permalink": "https://reddit.com/r/videos/comments/b/v/",- "thumbnail": "https://thumb/b.jpg",- "mediaType": "video",- "isSelf": false,- "isVideo": true,- "isNsfw": true,- "createdAt": "2026-07-26T21:06:40.500Z",- "flair": "",- "awardsCount": 0- }- ],- "requests": [- {- "url": "https://www.reddit.com/user/ribbon/submitted.json?limit=100&sort=new",- "method": "GET",- "headers": {- "User-Agent": "script:twiligent:v1.0 (by /u/spacesdrive)",- "Accept": "application/json",- "Cookie": "reddit_session=COOKIE"- }- },- {- "url": "https://www.reddit.com/user/ribbon/submitted.json?limit=97&sort=new&after=t3_c",- "method": "GET",- "headers": {- "User-Agent": "script:twiligent:v1.0 (by /u/spacesdrive)",- "Accept": "application/json",- "Cookie": "reddit_session=COOKIE"- }- },- {- "url": "https://www.reddit.com/user/ribbon/submitted.json?limit=95&sort=new&after=t3_e",- "method": "GET",- "headers": {- "User-Agent": "script:twiligent:v1.0 (by /u/spacesdrive)",- "Accept": "application/json",- "Cookie": "reddit_session=COOKIE"- }- },- {- "url": "https://www.reddit.com/user/ribbon/submitted.json?limit=2&sort=new",- "method": "GET",- "headers": {- "User-Agent": "script:twiligent:v1.0 (by /u/spacesdrive)",- "Accept": "application/json",- "Cookie": "reddit_session=COOKIE"- }- }- ]-}diff --git a/backend/tests/fixtures/reddit.profile.golden.json b/backend/tests/fixtures/reddit.profile.golden.jsondeleted file mode 100644index 8c0a22b..0000000--- a/backend/tests/fixtures/reddit.profile.golden.json+++ /dev/null@@ -1,70 +0,0 @@-{- "profiles": [- {- "username": "ribbon",- "totalKarma": 900,- "postKarma": 600,- "commentKarma": 300,- "awardeeKarma": 5,- "awarderKarma": 2,- "iconUrl": "https://i/a.png?x=1&y=2",- "createdAt": "2020-09-13T12:26:40.000Z",- "isGold": true,- "isMod": true,- "verified": true- },- {- "username": "plain",- "totalKarma": 10,- "postKarma": 4,- "commentKarma": 6,- "awardeeKarma": 0,- "awarderKarma": 0,- "iconUrl": "https://i/s.png",- "createdAt": "",- "isGold": false,- "isMod": false,- "verified": false- },- {- "username": "empty",- "totalKarma": 0,- "postKarma": 0,- "commentKarma": 0,- "awardeeKarma": 0,- "awarderKarma": 0,- "iconUrl": "",- "createdAt": "",- "isGold": false,- "isMod": false,- "verified": false- }- ],- "requests": [- {- "url": "https://www.reddit.com/user/ribbon/about.json",- "method": "GET",- "headers": {- "User-Agent": "script:twiligent:v1.0 (by /u/spacesdrive)",- "Accept": "application/json",- "Cookie": "reddit_session=COOKIE"- }- },- {- "url": "https://www.reddit.com/user/plain/about.json",- "method": "GET",- "headers": {- "User-Agent": "script:twiligent:v1.0 (by /u/spacesdrive)",- "Accept": "application/json"- }- },- {- "url": "https://www.reddit.com/user/empty/about.json",- "method": "GET",- "headers": {- "User-Agent": "script:twiligent:v1.0 (by /u/spacesdrive)",- "Accept": "application/json"- }- }- ]-}diff --git a/backend/tests/fixtures/reddit.tracked.golden.json b/backend/tests/fixtures/reddit.tracked.golden.jsondeleted file mode 100644index 57d509f..0000000--- a/backend/tests/fixtures/reddit.tracked.golden.json+++ /dev/null@@ -1,89 +0,0 @@-{- "outcomes": [- {- "value": {- "postId": "p1",- "title": "Tracked",- "subreddit": "webdev",- "subredditPrefixed": "r/webdev",- "author": "[deleted]",- "score": 77,- "upvoteRatio": 0.93,- "numComments": 8,- "permalink": "https://reddit.com/r/webdev/comments/p1/tracked/",- "isNsfw": false,- "createdAt": "2026-07-25T17:20:00.000Z",- "lastFetchedAt": "2026-09-01T12:00:00.000Z"- }- },- {- "value": {- "postId": "p2",- "title": "Sparse",- "subreddit": "misc",- "subredditPrefixed": "r/misc",- "author": "[deleted]",- "score": 0,- "upvoteRatio": 0,- "numComments": 0,- "permalink": "https://reddit.com/r/misc/comments/p2/",- "isNsfw": false,- "createdAt": "",- "lastFetchedAt": "2026-09-01T12:00:00.000Z"- }- },- {- "error": "Unexpected Reddit response - post may be deleted or private"- },- {- "error": "Post not found or has been deleted"- },- {- "error": "Invalid URL - paste the full post link from reddit.com"- },- {- "error": "Not a Reddit URL - paste a link from reddit.com"- },- {- "error": "Not a Reddit post URL - paste the full post link including /r/.../comments/..."- }- ],- "requests": [- {- "url": "https://www.reddit.com/r/webdev/comments/p1/tracked.json",- "method": "GET",- "headers": {- "User-Agent": "script:twiligent:v1.0 (by /u/spacesdrive)",- "Accept": "application/json",- "Cookie": "reddit_session=COOKIE"- }- },- {- "url": "https://www.reddit.com/r/misc/comments/p2.json",- "method": "GET",- "headers": {- "User-Agent": "script:twiligent:v1.0 (by /u/spacesdrive)",- "Accept": "application/json",- "Cookie": "reddit_session=COOKIE"- }- },- {- "url": "https://www.reddit.com/r/misc/comments/p3/x.json",- "method": "GET",- "headers": {- "User-Agent": "script:twiligent:v1.0 (by /u/spacesdrive)",- "Accept": "application/json",- "Cookie": "reddit_session=COOKIE"- }- },- {- "url": "https://www.reddit.com/r/misc/comments/p4/x.json",- "method": "GET",- "headers": {- "User-Agent": "script:twiligent:v1.0 (by /u/spacesdrive)",- "Accept": "application/json",- "Cookie": "reddit_session=COOKIE"- }- }- ]-}diff --git a/backend/tests/fixtures/redditAnalytics.empty.golden.json b/backend/tests/fixtures/redditAnalytics.empty.golden.jsondeleted file mode 100644index 6b417e1..0000000--- a/backend/tests/fixtures/redditAnalytics.empty.golden.json+++ /dev/null@@ -1,62 +0,0 @@-{- "empty": {- "fetchedPosts": 0,- "totalScore": 0,- "avgScore": 0,- "medianScore": 0,- "totalComments": 0,- "avgComments": 0,- "avgUpvoteRatio": 0,- "totalAwards": 0,- "avgAwards": 0,- "topPosts": [],- "worstPosts": [],- "subredditBreakdown": [],- "mediaTypeDistribution": {},- "postsByDayOfWeek": [],- "postsByHour": [],- "monthlyBreakdown": [],- "engagementTimeline": [],- "postsLast7Days": 0,- "postsLast30Days": 0,- "postsLast90Days": 0,- "postFrequency": {- "perWeek": 0,- "perMonth": 0- },- "viralityScore": 0,- "consistencyScore": 0,- "bestPostingDay": "",- "bestPostingHour": ""- },- "missing": {- "fetchedPosts": 0,- "totalScore": 0,- "avgScore": 0,- "medianScore": 0,- "totalComments": 0,- "avgComments": 0,- "avgUpvoteRatio": 0,- "totalAwards": 0,- "avgAwards": 0,- "topPosts": [],- "worstPosts": [],- "subredditBreakdown": [],- "mediaTypeDistribution": {},- "postsByDayOfWeek": [],- "postsByHour": [],- "monthlyBreakdown": [],- "engagementTimeline": [],- "postsLast7Days": 0,- "postsLast30Days": 0,- "postsLast90Days": 0,- "postFrequency": {- "perWeek": 0,- "perMonth": 0- },- "viralityScore": 0,- "consistencyScore": 0,- "bestPostingDay": "",- "bestPostingHour": ""- }-}diff --git a/backend/tests/fixtures/redditAnalytics.generated.golden.json b/backend/tests/fixtures/redditAnalytics.generated.golden.jsondeleted file mode 100644index 865b7f5..0000000--- a/backend/tests/fixtures/redditAnalytics.generated.golden.json+++ /dev/null@@ -1,722 +0,0 @@-{- "fetchedPosts": 30,- "totalScore": 5855,- "avgScore": 195,- "medianScore": 195,- "totalComments": 825,- "avgComments": 28,- "avgUpvoteRatio": 48.5,- "totalAwards": 30,- "avgAwards": 1,- "topPosts": [- {- "id": "g15",- "title": "Post g15",- "subreddit": "sub15",- "subredditPrefixed": "r/sub15",- "score": 395,- "upvoteRatio": 0.95,- "numComments": 45,- "url": "https://reddit.com/r/sub15/comments/g15/",- "permalink": "https://reddit.com/r/sub15/comments/g15/post/",- "thumbnail": "",- "mediaType": "link",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-07-24T08:00:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "g07",- "title": "Post g07",- "subreddit": "sub7",- "subredditPrefixed": "r/sub7",- "score": 371,- "upvoteRatio": 0.91,- "numComments": 49,- "url": "https://reddit.com/r/sub7/comments/g07/",- "permalink": "https://reddit.com/r/sub7/comments/g07/post/",- "thumbnail": "",- "mediaType": "link",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-13T08:00:00.000Z",- "flair": "",- "awardsCount": 1- },- {- "id": "g22",- "title": "Post g22",- "subreddit": "sub22",- "subredditPrefixed": "r/sub22",- "score": 366,- "upvoteRatio": 0.86,- "numComments": 34,- "url": "https://reddit.com/r/sub22/comments/g22/",- "permalink": "https://reddit.com/r/sub22/comments/g22/post/",- "thumbnail": "",- "mediaType": "video",- "isSelf": false,- "isVideo": true,- "isNsfw": false,- "createdAt": "2026-07-06T20:00:00.000Z",- "flair": "",- "awardsCount": 1- },- {- "id": "g14",- "title": "Post g14",- "subreddit": "sub14",- "subredditPrefixed": "r/sub14",- "score": 342,- "upvoteRatio": 0.82,- "numComments": 38,- "url": "https://reddit.com/r/sub14/comments/g14/",- "permalink": "https://reddit.com/r/sub14/comments/g14/post/",- "thumbnail": "",- "mediaType": "video",- "isSelf": false,- "isVideo": true,- "isNsfw": false,- "createdAt": "2026-07-26T20:00:00.000Z",- "flair": "",- "awardsCount": 2- },- {- "id": "g29",- "title": "Post g29",- "subreddit": "sub4",- "subredditPrefixed": "r/sub4",- "score": 337,- "upvoteRatio": 0.77,- "numComments": 23,- "url": "https://reddit.com/r/sub4/comments/g29/",- "permalink": "https://reddit.com/r/sub4/comments/g29/post/",- "thumbnail": "",- "mediaType": "image",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-06-19T08:00:00.000Z",- "flair": "",- "awardsCount": 2- },- {- "id": "g06",- "title": "Post g06",- "subreddit": "sub6",- "subredditPrefixed": "r/sub6",- "score": 318,- "upvoteRatio": 0.78,- "numComments": 42,- "url": "https://reddit.com/r/sub6/comments/g06/",- "permalink": "https://reddit.com/r/sub6/comments/g06/post/",- "thumbnail": "",- "mediaType": "video",- "isSelf": false,- "isVideo": true,- "isNsfw": false,- "createdAt": "2026-08-15T20:00:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "g21",- "title": "Post g21",- "subreddit": "sub21",- "subredditPrefixed": "r/sub21",- "score": 313,- "upvoteRatio": 0.73,- "numComments": 27,- "url": "https://reddit.com/r/sub21/comments/g21/",- "permalink": "https://reddit.com/r/sub21/comments/g21/post/",- "thumbnail": "",- "mediaType": "image",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-07-09T08:00:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "g13",- "title": "Post g13",- "subreddit": "sub13",- "subredditPrefixed": "r/sub13",- "score": 289,- "upvoteRatio": 0.69,- "numComments": 31,- "url": "https://reddit.com/r/sub13/comments/g13/",- "permalink": "https://reddit.com/r/sub13/comments/g13/post/",- "thumbnail": "",- "mediaType": "image",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-07-29T08:00:00.000Z",- "flair": "",- "awardsCount": 1- },- {- "id": "g28",- "title": "Post g28",- "subreddit": "sub3",- "subredditPrefixed": "r/sub3",- "score": 284,- "upvoteRatio": 0.64,- "numComments": 16,- "url": "https://reddit.com/r/sub3/comments/g28/",- "permalink": "https://reddit.com/r/sub3/comments/g28/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-06-21T20:00:00.000Z",- "flair": "",- "awardsCount": 1- },- {- "id": "g05",- "title": "Post g05",- "subreddit": "sub5",- "subredditPrefixed": "r/sub5",- "score": 265,- "upvoteRatio": 0.65,- "numComments": 35,- "url": "https://reddit.com/r/sub5/comments/g05/",- "permalink": "https://reddit.com/r/sub5/comments/g05/post/",- "thumbnail": "",- "mediaType": "image",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-18T08:00:00.000Z",- "flair": "",- "awardsCount": 2- }- ],- "worstPosts": [- {- "id": "g00",- "title": "Post g00",- "subreddit": "sub0",- "subredditPrefixed": "r/sub0",- "score": 0,- "upvoteRatio": 0,- "numComments": 0,- "url": "https://reddit.com/r/sub0/comments/g00/",- "permalink": "https://reddit.com/r/sub0/comments/g00/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-30T20:00:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "g23",- "title": "Post g23",- "subreddit": "sub23",- "subredditPrefixed": "r/sub23",- "score": 19,- "upvoteRatio": 0.99,- "numComments": 41,- "url": "https://reddit.com/r/sub23/comments/g23/",- "permalink": "https://reddit.com/r/sub23/comments/g23/post/",- "thumbnail": "",- "mediaType": "link",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-07-04T08:00:00.000Z",- "flair": "",- "awardsCount": 2- },- {- "id": "g08",- "title": "Post g08",- "subreddit": "sub8",- "subredditPrefixed": "r/sub8",- "score": 24,- "upvoteRatio": 0.04,- "numComments": 56,- "url": "https://reddit.com/r/sub8/comments/g08/",- "permalink": "https://reddit.com/r/sub8/comments/g08/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-10T20:00:00.000Z",- "flair": "",- "awardsCount": 2- },- {- "id": "g16",- "title": "Post g16",- "subreddit": "sub16",- "subredditPrefixed": "r/sub16",- "score": 48,- "upvoteRatio": 0.08,- "numComments": 52,- "url": "https://reddit.com/r/sub16/comments/g16/",- "permalink": "https://reddit.com/r/sub16/comments/g16/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-07-21T20:00:00.000Z",- "flair": "",- "awardsCount": 1- },- {- "id": "g01",- "title": "Post g01",- "subreddit": "sub1",- "subredditPrefixed": "r/sub1",- "score": 53,- "upvoteRatio": 0.13,- "numComments": 7,- "url": "https://reddit.com/r/sub1/comments/g01/",- "permalink": "https://reddit.com/r/sub1/comments/g01/post/",- "thumbnail": "",- "mediaType": "image",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-28T08:00:00.000Z",- "flair": "",- "awardsCount": 1- }- ],- "subredditBreakdown": [- {- "subreddit": "sub0",- "posts": 2,- "totalScore": 125,- "totalComments": 55,- "avgScore": 63,- "avgComments": 28- },- {- "subreddit": "sub1",- "posts": 2,- "totalScore": 231,- "totalComments": 9,- "avgScore": 116,- "avgComments": 5- },- {- "subreddit": "sub2",- "posts": 2,- "totalScore": 337,- "totalComments": 23,- "avgScore": 169,- "avgComments": 12- },- {- "subreddit": "sub3",- "posts": 2,- "totalScore": 443,- "totalComments": 37,- "avgScore": 222,- "avgComments": 19- },- {- "subreddit": "sub4",- "posts": 2,- "totalScore": 549,- "totalComments": 51,- "avgScore": 275,- "avgComments": 26- },- {- "subreddit": "sub5",- "posts": 1,- "totalScore": 265,- "totalComments": 35,- "avgScore": 265,- "avgComments": 35- },- {- "subreddit": "sub6",- "posts": 1,- "totalScore": 318,- "totalComments": 42,- "avgScore": 318,- "avgComments": 42- },- {- "subreddit": "sub7",- "posts": 1,- "totalScore": 371,- "totalComments": 49,- "avgScore": 371,- "avgComments": 49- },- {- "subreddit": "sub8",- "posts": 1,- "totalScore": 24,- "totalComments": 56,- "avgScore": 24,- "avgComments": 56- },- {- "subreddit": "sub9",- "posts": 1,- "totalScore": 77,- "totalComments": 3,- "avgScore": 77,- "avgComments": 3- },- {- "subreddit": "sub10",- "posts": 1,- "totalScore": 130,- "totalComments": 10,- "avgScore": 130,- "avgComments": 10- },- {- "subreddit": "sub11",- "posts": 1,- "totalScore": 183,- "totalComments": 17,- "avgScore": 183,- "avgComments": 17- },- {- "subreddit": "sub12",- "posts": 1,- "totalScore": 236,- "totalComments": 24,- "avgScore": 236,- "avgComments": 24- },- {- "subreddit": "sub13",- "posts": 1,- "totalScore": 289,- "totalComments": 31,- "avgScore": 289,- "avgComments": 31- },- {- "subreddit": "sub14",- "posts": 1,- "totalScore": 342,- "totalComments": 38,- "avgScore": 342,- "avgComments": 38- },- {- "subreddit": "sub15",- "posts": 1,- "totalScore": 395,- "totalComments": 45,- "avgScore": 395,- "avgComments": 45- },- {- "subreddit": "sub16",- "posts": 1,- "totalScore": 48,- "totalComments": 52,- "avgScore": 48,- "avgComments": 52- },- {- "subreddit": "sub17",- "posts": 1,- "totalScore": 101,- "totalComments": 59,- "avgScore": 101,- "avgComments": 59- },- {- "subreddit": "sub18",- "posts": 1,- "totalScore": 154,- "totalComments": 6,- "avgScore": 154,- "avgComments": 6- },- {- "subreddit": "sub19",- "posts": 1,- "totalScore": 207,- "totalComments": 13,- "avgScore": 207,- "avgComments": 13- }- ],- "mediaTypeDistribution": {- "text": 8,- "image": 8,- "video": 7,- "link": 7- },- "postsByDayOfWeek": [- {- "day": "Sunday",- "shortDay": "Sun",- "posts": 5,- "avgScore": 177,- "avgComments": 27- },- {- "day": "Monday",- "shortDay": "Mon",- "posts": 4,- "avgScore": 175,- "avgComments": 41- },- {- "day": "Tuesday",- "shortDay": "Tue",- "posts": 4,- "avgScore": 157,- "avgComments": 29- },- {- "day": "Wednesday",- "shortDay": "Wed",- "posts": 4,- "avgScore": 181,- "avgComments": 25- },- {- "day": "Thursday",- "shortDay": "Thu",- "posts": 4,- "avgScore": 263,- "avgComments": 28- },- {- "day": "Friday",- "shortDay": "Fri",- "posts": 5,- "avgScore": 240,- "avgComments": 20- },- {- "day": "Saturday",- "shortDay": "Sat",- "posts": 4,- "avgScore": 169,- "avgComments": 27- }- ],- "bestPostingDay": "Thursday",- "postsByHour": [- {- "hour": 0,- "label": "0:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 1,- "label": "1:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 2,- "label": "2:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 3,- "label": "3:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 4,- "label": "4:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 5,- "label": "5:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 6,- "label": "6:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 7,- "label": "7:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 8,- "label": "8:00",- "posts": 15,- "avgScore": 208- },- {- "hour": 9,- "label": "9:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 10,- "label": "10:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 11,- "label": "11:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 12,- "label": "12:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 13,- "label": "13:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 14,- "label": "14:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 15,- "label": "15:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 16,- "label": "16:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 17,- "label": "17:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 18,- "label": "18:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 19,- "label": "19:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 20,- "label": "20:00",- "posts": 15,- "avgScore": 182- },- {- "hour": 21,- "label": "21:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 22,- "label": "22:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 23,- "label": "23:00",- "posts": 0,- "avgScore": 0- }- ],- "bestPostingHour": "8:00",- "monthlyBreakdown": [- {- "month": "2026-06",- "posts": 5,- "score": 1155,- "comments": 105,- "avgScore": 231- },- {- "month": "2026-07",- "posts": 13,- "score": 2802,- "comments": 438,- "avgScore": 216- },- {- "month": "2026-08",- "posts": 12,- "score": 1898,- "comments": 282,- "avgScore": 158- }- ],- "engagementTimeline": [- {- "month": "2026-06",- "posts": 5,- "score": 1155,- "comments": 105,- "avgScore": 231- },- {- "month": "2026-07",- "posts": 13,- "score": 2802,- "comments": 438,- "avgScore": 216- },- {- "month": "2026-08",- "posts": 12,- "score": 1898,- "comments": 282,- "avgScore": 158- }- ],- "postsLast7Days": 3,- "postsLast30Days": 12,- "postsLast90Days": 30,- "postFrequency": {- "perWeek": 2.9,- "perMonth": 12.4- },- "viralityScore": 2,- "consistencyScore": 63-}diff --git a/backend/tests/fixtures/redditAnalytics.rich.golden.json b/backend/tests/fixtures/redditAnalytics.rich.golden.jsondeleted file mode 100644index 19aa6e4..0000000--- a/backend/tests/fixtures/redditAnalytics.rich.golden.json+++ /dev/null@@ -1,619 +0,0 @@-{- "fetchedPosts": 11,- "totalScore": 1979,- "avgScore": 180,- "medianScore": 35,- "totalComments": 488,- "avgComments": 44,- "avgUpvoteRatio": 78.5,- "totalAwards": 18,- "avgAwards": 1.64,- "topPosts": [- {- "id": "r10",- "title": "Post r10",- "subreddit": "webdev",- "subredditPrefixed": "r/webdev",- "score": 1200,- "upvoteRatio": 0.98,- "numComments": 340,- "url": "https://reddit.com/r/webdev/comments/r10/",- "permalink": "https://reddit.com/r/webdev/comments/r10/post/",- "thumbnail": "",- "mediaType": "image",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-05-01T15:45:00.000Z",- "flair": "",- "awardsCount": 12- },- {- "id": "r01",- "title": "Post r01",- "subreddit": "webdev",- "subredditPrefixed": "r/webdev",- "score": 420,- "upvoteRatio": 0.97,- "numComments": 61,- "url": "https://reddit.com/r/webdev/comments/r01/",- "permalink": "https://reddit.com/r/webdev/comments/r01/post/",- "thumbnail": "",- "mediaType": "link",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-31T09:15:00.000Z",- "flair": "",- "awardsCount": 2- },- {- "id": "r08",- "title": "Post r08",- "subreddit": "node",- "subredditPrefixed": "r/node",- "score": 150,- "upvoteRatio": 0.95,- "numComments": 22,- "url": "https://reddit.com/r/node/comments/r08/",- "permalink": "https://reddit.com/r/node/comments/r08/post/",- "thumbnail": "",- "mediaType": "video",- "isSelf": false,- "isVideo": true,- "isNsfw": false,- "createdAt": "2026-06-20T23:59:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "r07",- "title": "Post r07",- "subreddit": "reactjs",- "subredditPrefixed": "r/reactjs",- "score": 88,- "upvoteRatio": 0.92,- "numComments": 30,- "url": "https://reddit.com/r/reactjs/comments/r07/",- "permalink": "https://reddit.com/r/reactjs/comments/r07/post/",- "thumbnail": "",- "mediaType": "link",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-07-02T12:00:00.000Z",- "flair": "",- "awardsCount": 3- },- {- "id": "r02",- "title": "Post r02",- "subreddit": "javascript",- "subredditPrefixed": "r/javascript",- "score": 35,- "upvoteRatio": 0.88,- "numComments": 12,- "url": "https://reddit.com/r/javascript/comments/r02/",- "permalink": "https://reddit.com/r/javascript/comments/r02/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-29T18:40:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "r03",- "title": "Post r03",- "subreddit": "webdev",- "subredditPrefixed": "r/webdev",- "score": 35,- "upvoteRatio": 0.9,- "numComments": 4,- "url": "https://reddit.com/r/webdev/comments/r03/",- "permalink": "https://reddit.com/r/webdev/comments/r03/post/",- "thumbnail": "",- "mediaType": "image",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-25T09:05:00.000Z",- "flair": ""- },- {- "id": "r09",- "title": "Post r09",- "subreddit": "reactjs",- "subredditPrefixed": "r/reactjs",- "score": 35,- "upvoteRatio": 0.81,- "numComments": 7,- "url": "https://reddit.com/r/reactjs/comments/r09/",- "permalink": "https://reddit.com/r/reactjs/comments/r09/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-06-03T00:00:00.000Z",- "flair": ""- },- {- "id": "r04",- "title": "Post r04",- "subreddit": "node",- "subredditPrefixed": "r/node",- "score": 12,- "upvoteRatio": 0.75,- "numComments": 1,- "url": "https://reddit.com/r/node/comments/r04/",- "permalink": "https://reddit.com/r/node/comments/r04/post/",- "thumbnail": "",- "mediaType": "video",- "isSelf": false,- "isVideo": true,- "isNsfw": false,- "createdAt": "",- "flair": "",- "awardsCount": 1- },- {- "id": "r11",- "title": "Post r11",- "subreddit": "javascript",- "subredditPrefixed": "r/javascript",- "score": 7,- "upvoteRatio": 0.66,- "numComments": 2,- "url": "https://reddit.com/r/javascript/comments/r11/",- "permalink": "https://reddit.com/r/javascript/comments/r11/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2025-12-31T23:30:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "r06",- "title": "Post r06",- "subreddit": "webdev",- "subredditPrefixed": "r/webdev",- "score": 0,- "upvoteRatio": 0.5,- "numComments": 0,- "url": "https://reddit.com/r/webdev/comments/r06/",- "permalink": "https://reddit.com/r/webdev/comments/r06/post/",- "thumbnail": "",- "mediaType": "image",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-07-14T06:30:00.000Z",- "flair": "",- "awardsCount": 0- }- ],- "worstPosts": [- {- "id": "r05",- "title": "Post r05",- "subreddit": "javascript",- "subredditPrefixed": "r/javascript",- "score": -3,- "upvoteRatio": 0.31,- "numComments": 9,- "url": "https://reddit.com/r/javascript/comments/r05/",- "permalink": "https://reddit.com/r/javascript/comments/r05/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-10T21:00:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "r06",- "title": "Post r06",- "subreddit": "webdev",- "subredditPrefixed": "r/webdev",- "score": 0,- "upvoteRatio": 0.5,- "numComments": 0,- "url": "https://reddit.com/r/webdev/comments/r06/",- "permalink": "https://reddit.com/r/webdev/comments/r06/post/",- "thumbnail": "",- "mediaType": "image",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-07-14T06:30:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "r11",- "title": "Post r11",- "subreddit": "javascript",- "subredditPrefixed": "r/javascript",- "score": 7,- "upvoteRatio": 0.66,- "numComments": 2,- "url": "https://reddit.com/r/javascript/comments/r11/",- "permalink": "https://reddit.com/r/javascript/comments/r11/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2025-12-31T23:30:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "r04",- "title": "Post r04",- "subreddit": "node",- "subredditPrefixed": "r/node",- "score": 12,- "upvoteRatio": 0.75,- "numComments": 1,- "url": "https://reddit.com/r/node/comments/r04/",- "permalink": "https://reddit.com/r/node/comments/r04/post/",- "thumbnail": "",- "mediaType": "video",- "isSelf": false,- "isVideo": true,- "isNsfw": false,- "createdAt": "",- "flair": "",- "awardsCount": 1- },- {- "id": "r09",- "title": "Post r09",- "subreddit": "reactjs",- "subredditPrefixed": "r/reactjs",- "score": 35,- "upvoteRatio": 0.81,- "numComments": 7,- "url": "https://reddit.com/r/reactjs/comments/r09/",- "permalink": "https://reddit.com/r/reactjs/comments/r09/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-06-03T00:00:00.000Z",- "flair": ""- }- ],- "subredditBreakdown": [- {- "subreddit": "webdev",- "posts": 4,- "totalScore": 1655,- "totalComments": 405,- "avgScore": 414,- "avgComments": 101- },- {- "subreddit": "javascript",- "posts": 3,- "totalScore": 39,- "totalComments": 23,- "avgScore": 13,- "avgComments": 8- },- {- "subreddit": "node",- "posts": 2,- "totalScore": 162,- "totalComments": 23,- "avgScore": 81,- "avgComments": 12- },- {- "subreddit": "reactjs",- "posts": 2,- "totalScore": 123,- "totalComments": 37,- "avgScore": 62,- "avgComments": 19- }- ],- "mediaTypeDistribution": {- "link": 2,- "text": 4,- "image": 3,- "video": 2- },- "postsByDayOfWeek": [- {- "day": "Sunday",- "shortDay": "Sun",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Monday",- "shortDay": "Mon",- "posts": 2,- "avgScore": 216,- "avgComments": 31- },- {- "day": "Tuesday",- "shortDay": "Tue",- "posts": 2,- "avgScore": 16,- "avgComments": 7- },- {- "day": "Wednesday",- "shortDay": "Wed",- "posts": 2,- "avgScore": 675,- "avgComments": 181- },- {- "day": "Thursday",- "shortDay": "Thu",- "posts": 1,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Friday",- "shortDay": "Fri",- "posts": 1,- "avgScore": 35,- "avgComments": 7- },- {- "day": "Saturday",- "shortDay": "Sat",- "posts": 2,- "avgScore": 62,- "avgComments": 21- }- ],- "bestPostingDay": "Wednesday",- "postsByHour": [- {- "hour": 0,- "label": "0:00",- "posts": 1,- "avgScore": 150- },- {- "hour": 1,- "label": "1:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 2,- "label": "2:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 3,- "label": "3:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 4,- "label": "4:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 5,- "label": "5:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 6,- "label": "6:00",- "posts": 1,- "avgScore": -3- },- {- "hour": 7,- "label": "7:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 8,- "label": "8:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 9,- "label": "9:00",- "posts": 2,- "avgScore": 228- },- {- "hour": 10,- "label": "10:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 11,- "label": "11:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 12,- "label": "12:00",- "posts": 1,- "avgScore": 0- },- {- "hour": 13,- "label": "13:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 14,- "label": "14:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 15,- "label": "15:00",- "posts": 1,- "avgScore": 35- },- {- "hour": 16,- "label": "16:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 17,- "label": "17:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 18,- "label": "18:00",- "posts": 1,- "avgScore": 35- },- {- "hour": 19,- "label": "19:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 20,- "label": "20:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 21,- "label": "21:00",- "posts": 1,- "avgScore": 12- },- {- "hour": 22,- "label": "22:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 23,- "label": "23:00",- "posts": 2,- "avgScore": 644- }- ],- "bestPostingHour": "23:00",- "monthlyBreakdown": [- {- "month": "2025-12",- "posts": 1,- "score": 7,- "comments": 2,- "avgScore": 7- },- {- "month": "2026-05",- "posts": 1,- "score": 1200,- "comments": 340,- "avgScore": 1200- },- {- "month": "2026-06",- "posts": 2,- "score": 185,- "comments": 29,- "avgScore": 93- },- {- "month": "2026-07",- "posts": 2,- "score": 88,- "comments": 30,- "avgScore": 44- },- {- "month": "2026-08",- "posts": 4,- "score": 487,- "comments": 86,- "avgScore": 122- }- ],- "engagementTimeline": [- {- "month": "2025-12",- "posts": 1,- "score": 7,- "comments": 2,- "avgScore": 7- },- {- "month": "2026-05",- "posts": 1,- "score": 1200,- "comments": 340,- "avgScore": 1200- },- {- "month": "2026-06",- "posts": 2,- "score": 185,- "comments": 29,- "avgScore": 93- },- {- "month": "2026-07",- "posts": 2,- "score": 88,- "comments": 30,- "avgScore": 44- },- {- "month": "2026-08",- "posts": 4,- "score": 487,- "comments": 86,- "avgScore": 122- }- ],- "postsLast7Days": 2,- "postsLast30Days": 4,- "postsLast90Days": 7,- "postFrequency": {- "perWeek": 0.3,- "perMonth": 1.4- },- "viralityScore": 6.7,- "consistencyScore": 34-}diff --git a/backend/tests/fixtures/redditAnalytics.small.golden.json b/backend/tests/fixtures/redditAnalytics.small.golden.jsondeleted file mode 100644index 2c0ec51..0000000--- a/backend/tests/fixtures/redditAnalytics.small.golden.json+++ /dev/null@@ -1,631 +0,0 @@-{- "single": {- "fetchedPosts": 1,- "totalScore": 420,- "avgScore": 420,- "medianScore": 420,- "totalComments": 61,- "avgComments": 61,- "avgUpvoteRatio": 97,- "totalAwards": 2,- "avgAwards": 2,- "topPosts": [- {- "id": "r01",- "title": "Post r01",- "subreddit": "webdev",- "subredditPrefixed": "r/webdev",- "score": 420,- "upvoteRatio": 0.97,- "numComments": 61,- "url": "https://reddit.com/r/webdev/comments/r01/",- "permalink": "https://reddit.com/r/webdev/comments/r01/post/",- "thumbnail": "",- "mediaType": "link",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-31T09:15:00.000Z",- "flair": "",- "awardsCount": 2- }- ],- "worstPosts": [- {- "id": "r01",- "title": "Post r01",- "subreddit": "webdev",- "subredditPrefixed": "r/webdev",- "score": 420,- "upvoteRatio": 0.97,- "numComments": 61,- "url": "https://reddit.com/r/webdev/comments/r01/",- "permalink": "https://reddit.com/r/webdev/comments/r01/post/",- "thumbnail": "",- "mediaType": "link",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-31T09:15:00.000Z",- "flair": "",- "awardsCount": 2- }- ],- "subredditBreakdown": [- {- "subreddit": "webdev",- "posts": 1,- "totalScore": 420,- "totalComments": 61,- "avgScore": 420,- "avgComments": 61- }- ],- "mediaTypeDistribution": {- "link": 1- },- "postsByDayOfWeek": [- {- "day": "Sunday",- "shortDay": "Sun",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Monday",- "shortDay": "Mon",- "posts": 1,- "avgScore": 420,- "avgComments": 61- },- {- "day": "Tuesday",- "shortDay": "Tue",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Wednesday",- "shortDay": "Wed",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Thursday",- "shortDay": "Thu",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Friday",- "shortDay": "Fri",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Saturday",- "shortDay": "Sat",- "posts": 0,- "avgScore": 0,- "avgComments": 0- }- ],- "bestPostingDay": "Monday",- "postsByHour": [- {- "hour": 0,- "label": "0:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 1,- "label": "1:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 2,- "label": "2:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 3,- "label": "3:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 4,- "label": "4:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 5,- "label": "5:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 6,- "label": "6:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 7,- "label": "7:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 8,- "label": "8:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 9,- "label": "9:00",- "posts": 1,- "avgScore": 420- },- {- "hour": 10,- "label": "10:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 11,- "label": "11:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 12,- "label": "12:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 13,- "label": "13:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 14,- "label": "14:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 15,- "label": "15:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 16,- "label": "16:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 17,- "label": "17:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 18,- "label": "18:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 19,- "label": "19:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 20,- "label": "20:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 21,- "label": "21:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 22,- "label": "22:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 23,- "label": "23:00",- "posts": 0,- "avgScore": 0- }- ],- "bestPostingHour": "9:00",- "monthlyBreakdown": [- {- "month": "2026-08",- "posts": 1,- "score": 420,- "comments": 61,- "avgScore": 420- }- ],- "engagementTimeline": [- {- "month": "2026-08",- "posts": 1,- "score": 420,- "comments": 61,- "avgScore": 420- }- ],- "postsLast7Days": 1,- "postsLast30Days": 1,- "postsLast90Days": 1,- "postFrequency": {- "perWeek": 0,- "perMonth": 0- },- "viralityScore": 1,- "consistencyScore": 0- },- "pair": {- "fetchedPosts": 2,- "totalScore": 70,- "avgScore": 35,- "medianScore": 35,- "totalComments": 16,- "avgComments": 8,- "avgUpvoteRatio": 89,- "totalAwards": 0,- "avgAwards": 0,- "topPosts": [- {- "id": "r02",- "title": "Post r02",- "subreddit": "javascript",- "subredditPrefixed": "r/javascript",- "score": 35,- "upvoteRatio": 0.88,- "numComments": 12,- "url": "https://reddit.com/r/javascript/comments/r02/",- "permalink": "https://reddit.com/r/javascript/comments/r02/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-29T18:40:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "r03",- "title": "Post r03",- "subreddit": "webdev",- "subredditPrefixed": "r/webdev",- "score": 35,- "upvoteRatio": 0.9,- "numComments": 4,- "url": "https://reddit.com/r/webdev/comments/r03/",- "permalink": "https://reddit.com/r/webdev/comments/r03/post/",- "thumbnail": "",- "mediaType": "image",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-25T09:05:00.000Z",- "flair": ""- }- ],- "worstPosts": [- {- "id": "r03",- "title": "Post r03",- "subreddit": "webdev",- "subredditPrefixed": "r/webdev",- "score": 35,- "upvoteRatio": 0.9,- "numComments": 4,- "url": "https://reddit.com/r/webdev/comments/r03/",- "permalink": "https://reddit.com/r/webdev/comments/r03/post/",- "thumbnail": "",- "mediaType": "image",- "isSelf": false,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-25T09:05:00.000Z",- "flair": ""- },- {- "id": "r02",- "title": "Post r02",- "subreddit": "javascript",- "subredditPrefixed": "r/javascript",- "score": 35,- "upvoteRatio": 0.88,- "numComments": 12,- "url": "https://reddit.com/r/javascript/comments/r02/",- "permalink": "https://reddit.com/r/javascript/comments/r02/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-29T18:40:00.000Z",- "flair": "",- "awardsCount": 0- }- ],- "subredditBreakdown": [- {- "subreddit": "javascript",- "posts": 1,- "totalScore": 35,- "totalComments": 12,- "avgScore": 35,- "avgComments": 12- },- {- "subreddit": "webdev",- "posts": 1,- "totalScore": 35,- "totalComments": 4,- "avgScore": 35,- "avgComments": 4- }- ],- "mediaTypeDistribution": {- "text": 1,- "image": 1- },- "postsByDayOfWeek": [- {- "day": "Sunday",- "shortDay": "Sun",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Monday",- "shortDay": "Mon",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Tuesday",- "shortDay": "Tue",- "posts": 1,- "avgScore": 35,- "avgComments": 4- },- {- "day": "Wednesday",- "shortDay": "Wed",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Thursday",- "shortDay": "Thu",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Friday",- "shortDay": "Fri",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Saturday",- "shortDay": "Sat",- "posts": 1,- "avgScore": 35,- "avgComments": 12- }- ],- "bestPostingDay": "Tuesday",- "postsByHour": [- {- "hour": 0,- "label": "0:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 1,- "label": "1:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 2,- "label": "2:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 3,- "label": "3:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 4,- "label": "4:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 5,- "label": "5:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 6,- "label": "6:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 7,- "label": "7:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 8,- "label": "8:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 9,- "label": "9:00",- "posts": 1,- "avgScore": 35- },- {- "hour": 10,- "label": "10:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 11,- "label": "11:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 12,- "label": "12:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 13,- "label": "13:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 14,- "label": "14:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 15,- "label": "15:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 16,- "label": "16:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 17,- "label": "17:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 18,- "label": "18:00",- "posts": 1,- "avgScore": 35- },- {- "hour": 19,- "label": "19:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 20,- "label": "20:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 21,- "label": "21:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 22,- "label": "22:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 23,- "label": "23:00",- "posts": 0,- "avgScore": 0- }- ],- "bestPostingHour": "9:00",- "monthlyBreakdown": [- {- "month": "2026-08",- "posts": 2,- "score": 70,- "comments": 16,- "avgScore": 35- }- ],- "engagementTimeline": [- {- "month": "2026-08",- "posts": 2,- "score": 70,- "comments": 16,- "avgScore": 35- }- ],- "postsLast7Days": 1,- "postsLast30Days": 2,- "postsLast90Days": 2,- "postFrequency": {- "perWeek": 3.2,- "perMonth": 13.6- },- "viralityScore": 1,- "consistencyScore": 0- }-}diff --git a/backend/tests/fixtures/redditAnalytics.zero.golden.json b/backend/tests/fixtures/redditAnalytics.zero.golden.jsondeleted file mode 100644index 9d2bff0..0000000--- a/backend/tests/fixtures/redditAnalytics.zero.golden.json+++ /dev/null@@ -1,368 +0,0 @@-{- "fetchedPosts": 3,- "totalScore": 0,- "avgScore": 0,- "medianScore": 0,- "totalComments": 1,- "avgComments": 0,- "avgUpvoteRatio": 50,- "totalAwards": 0,- "avgAwards": 0,- "topPosts": [- {- "id": "z1",- "title": "Post z1",- "subreddit": "test",- "subredditPrefixed": "r/test",- "score": 0,- "upvoteRatio": 0.5,- "numComments": 0,- "url": "https://reddit.com/r/test/comments/z1/",- "permalink": "https://reddit.com/r/test/comments/z1/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-01T10:00:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "z2",- "title": "Post z2",- "subreddit": "test",- "subredditPrefixed": "r/test",- "score": 0,- "upvoteRatio": 0.5,- "numComments": 1,- "url": "https://reddit.com/r/test/comments/z2/",- "permalink": "https://reddit.com/r/test/comments/z2/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-02T10:00:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "z3",- "title": "Post z3",- "subreddit": "test",- "subredditPrefixed": "r/test",- "score": 0,- "upvoteRatio": 0.5,- "numComments": 0,- "url": "https://reddit.com/r/test/comments/z3/",- "permalink": "https://reddit.com/r/test/comments/z3/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-03T10:00:00.000Z",- "flair": "",- "awardsCount": 0- }- ],- "worstPosts": [- {- "id": "z3",- "title": "Post z3",- "subreddit": "test",- "subredditPrefixed": "r/test",- "score": 0,- "upvoteRatio": 0.5,- "numComments": 0,- "url": "https://reddit.com/r/test/comments/z3/",- "permalink": "https://reddit.com/r/test/comments/z3/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-03T10:00:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "z2",- "title": "Post z2",- "subreddit": "test",- "subredditPrefixed": "r/test",- "score": 0,- "upvoteRatio": 0.5,- "numComments": 1,- "url": "https://reddit.com/r/test/comments/z2/",- "permalink": "https://reddit.com/r/test/comments/z2/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-02T10:00:00.000Z",- "flair": "",- "awardsCount": 0- },- {- "id": "z1",- "title": "Post z1",- "subreddit": "test",- "subredditPrefixed": "r/test",- "score": 0,- "upvoteRatio": 0.5,- "numComments": 0,- "url": "https://reddit.com/r/test/comments/z1/",- "permalink": "https://reddit.com/r/test/comments/z1/post/",- "thumbnail": "",- "mediaType": "text",- "isSelf": true,- "isVideo": false,- "isNsfw": false,- "createdAt": "2026-08-01T10:00:00.000Z",- "flair": "",- "awardsCount": 0- }- ],- "subredditBreakdown": [- {- "subreddit": "test",- "posts": 3,- "totalScore": 0,- "totalComments": 1,- "avgScore": 0,- "avgComments": 0- }- ],- "mediaTypeDistribution": {- "text": 3- },- "postsByDayOfWeek": [- {- "day": "Sunday",- "shortDay": "Sun",- "posts": 1,- "avgScore": 0,- "avgComments": 1- },- {- "day": "Monday",- "shortDay": "Mon",- "posts": 1,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Tuesday",- "shortDay": "Tue",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Wednesday",- "shortDay": "Wed",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Thursday",- "shortDay": "Thu",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Friday",- "shortDay": "Fri",- "posts": 0,- "avgScore": 0,- "avgComments": 0- },- {- "day": "Saturday",- "shortDay": "Sat",- "posts": 1,- "avgScore": 0,- "avgComments": 0- }- ],- "bestPostingDay": "Sunday",- "postsByHour": [- {- "hour": 0,- "label": "0:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 1,- "label": "1:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 2,- "label": "2:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 3,- "label": "3:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 4,- "label": "4:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 5,- "label": "5:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 6,- "label": "6:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 7,- "label": "7:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 8,- "label": "8:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 9,- "label": "9:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 10,- "label": "10:00",- "posts": 3,- "avgScore": 0- },- {- "hour": 11,- "label": "11:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 12,- "label": "12:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 13,- "label": "13:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 14,- "label": "14:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 15,- "label": "15:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 16,- "label": "16:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 17,- "label": "17:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 18,- "label": "18:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 19,- "label": "19:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 20,- "label": "20:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 21,- "label": "21:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 22,- "label": "22:00",- "posts": 0,- "avgScore": 0- },- {- "hour": 23,- "label": "23:00",- "posts": 0,- "avgScore": 0- }- ],- "bestPostingHour": "",- "monthlyBreakdown": [- {- "month": "2026-08",- "posts": 3,- "score": 0,- "comments": 1,- "avgScore": 0- }- ],- "engagementTimeline": [- {- "month": "2026-08",- "posts": 3,- "score": 0,- "comments": 1,- "avgScore": 0- }- ],- "postsLast7Days": 0,- "postsLast30Days": 1,- "postsLast90Days": 3,- "postFrequency": {- "perWeek": 10.5,- "perMonth": 45- },- "viralityScore": 0,- "consistencyScore": 100-}diff --git a/backend/tests/fixtures/redditFixtures.ts b/backend/tests/fixtures/redditFixtures.tsdeleted file mode 100644index cf285fe..0000000--- a/backend/tests/fixtures/redditFixtures.ts+++ /dev/null@@ -1,69 +0,0 @@-import type { RedditPost } from '../../../shared/types/reddit.ts';--// mediaType is any string and awardsCount is left out when the counts tuple has no fourth entry-interface RedditPostFixture extends Omit<RedditPost, 'mediaType' | 'awardsCount'> {- mediaType: string;- awardsCount?: number;-}--export const FIXED_NOW = Date.parse('2026-09-01T12:00:00Z');--function redditPost(id: string, subreddit: string, createdAt: string, counts: [number, number, number, number?], mediaType = 'text'): RedditPost {- const [score, numComments, upvoteRatio, awardsCount] = counts;- const post: RedditPostFixture = {- id,- title: `Post ${id}`,- subreddit,- subredditPrefixed: `r/${subreddit}`,- score,- upvoteRatio,- numComments,- url: `https://reddit.com/r/${subreddit}/comments/${id}/`,- permalink: `https://reddit.com/r/${subreddit}/comments/${id}/post/`,- thumbnail: '',- mediaType,- isSelf: mediaType === 'text',- isVideo: mediaType === 'video',- isNsfw: false,- createdAt,- flair: '',- };- if (awardsCount !== undefined) post.awardsCount = awardsCount;- return post as RedditPost;-}--export const richPosts = [- redditPost('r01', 'webdev', '2026-08-31T09:15:00.000Z', [420, 61, 0.97, 2], 'link'),- redditPost('r02', 'javascript', '2026-08-29T18:40:00.000Z', [35, 12, 0.88, 0]),- redditPost('r03', 'webdev', '2026-08-25T09:05:00.000Z', [35, 4, 0.9], 'image'),- redditPost('r04', 'node', '', [12, 1, 0.75, 1], 'video'),- redditPost('r05', 'javascript', '2026-08-10T21:00:00.000Z', [-3, 9, 0.31, 0]),- redditPost('r06', 'webdev', '2026-07-14T06:30:00.000Z', [0, 0, 0.5, 0], 'image'),- redditPost('r07', 'reactjs', '2026-07-02T12:00:00.000Z', [88, 30, 0.92, 3], 'link'),- redditPost('r08', 'node', '2026-06-20T23:59:00.000Z', [150, 22, 0.95, 0], 'video'),- redditPost('r09', 'reactjs', '2026-06-03T00:00:00.000Z', [35, 7, 0.81]),- redditPost('r10', 'webdev', '2026-05-01T15:45:00.000Z', [1200, 340, 0.98, 12], 'image'),- redditPost('r11', 'javascript', '2025-12-31T23:30:00.000Z', [7, 2, 0.66, 0]),-];--export const zeroScorePosts = [- redditPost('z1', 'test', '2026-08-01T10:00:00.000Z', [0, 0, 0.5, 0]),- redditPost('z2', 'test', '2026-08-02T10:00:00.000Z', [0, 1, 0.5, 0]),- redditPost('z3', 'test', '2026-08-03T10:00:00.000Z', [0, 0, 0.5, 0]),-];--export const generatedPosts = Array.from({ length: 30 }, (_, index) => redditPost(- `g${String(index).padStart(2, '0')}`,- `sub${index % 25}`,- new Date(Date.UTC(2026, 7, 30, 20) - index * 2.5 * 86400000).toISOString(),- [(index * 53) % 400, (index * 7) % 60, ((index * 13) % 100) / 100, index % 3],- ['text', 'image', 'video', 'link'][index % 4],-));--export const rawRedditPosts = [- { id: 'a', title: 'Self post', subreddit: 'webdev', subreddit_name_prefixed: 'r/webdev', score: 10, upvote_ratio: 0.9, num_comments: 3, url: 'https://reddit.com/a', permalink: '/r/webdev/comments/a/self/', thumbnail: 'self', is_self: true, created_utc: 1785000000, link_flair_text: 'Discussion', total_awards_received: 1 },- { id: 'b', title: 'Video', subreddit: 'videos', is_video: true, post_hint: 'image', permalink: '/r/videos/comments/b/v/', thumbnail: 'https://thumb/b.jpg', over_18: true, created_utc: 1785100000.5 },- { id: 'c', title: 'Image', subreddit: 'pics', post_hint: 'image', is_self: true, permalink: '/r/pics/comments/c/i/', thumbnail: 'default' },- { id: 'd', title: 'Link', subreddit: 'news', post_hint: 'link', permalink: '/r/news/comments/d/l/', score: 0, upvote_ratio: 0 },- { id: 'e', title: 'Bare', subreddit: 'misc', permalink: '/r/misc/comments/e/b/', thumbnail: null, is_video: false, is_self: false },-];diff --git a/backend/tests/fixtures/scheduledPublisher.process.golden.json b/backend/tests/fixtures/scheduledPublisher.process.golden.jsonindex cd7c8e8..4785460 100644--- a/backend/tests/fixtures/scheduledPublisher.process.golden.json+++ b/backend/tests/fixtures/scheduledPublisher.process.golden.json@@ -510,6 +510,14 @@["id","ig1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -576,6 +584,14 @@["id","ig1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -642,6 +658,14 @@["id","igErr"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -706,6 +730,14 @@["id","igExp"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -771,6 +803,14 @@["id","gone"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -820,6 +860,14 @@["id","igBad"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -869,6 +917,14 @@["id","igPub"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -933,6 +989,14 @@["id","igSlow"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},@@ -997,6 +1061,14 @@["id","ig1"+ ],+ [+ "platform",+ [+ "youtube",+ "instagram"+ ],+ "in"]]},diff --git a/backend/tests/lib/circuitBreaker.test.ts b/backend/tests/lib/circuitBreaker.test.tsindex fe85ffa..0170f85 100644--- a/backend/tests/lib/circuitBreaker.test.ts+++ b/backend/tests/lib/circuitBreaker.test.ts@@ -85,13 +85,13 @@ test('a call the caller cancelled says nothing about the platform', async () =>});test('timeouts, unreachable hosts and server errors are outages; client errors and other failures are not', () => {- assert.equal(isOutage(new UpstreamTimeoutError('Reddit')), true);+ assert.equal(isOutage(new UpstreamTimeoutError('Instagram')), true);assert.equal(isOutage(new UpstreamError('down', { reason: 'unreachable' })), true);- assert.equal(isOutage(new UpstreamError('Reddit API 503: Service Unavailable', { status: 503 })), true);- assert.equal(isOutage(new UpstreamError('Reddit rate limit hit', { status: 429 })), false);+ assert.equal(isOutage(new UpstreamError('Instagram API 503: Service Unavailable', { status: 503 })), true);+ assert.equal(isOutage(new UpstreamError('Instagram rate limit hit', { status: 429 })), false);assert.equal(isOutage(new UpstreamError('Invalid OAuth access token', { status: 190 })), false);- assert.equal(isOutage(new NotFoundError('Reddit user not found')), false);- assert.equal(isOutage(new UpstreamTimeoutError('Reddit'), AbortSignal.abort()), false);+ assert.equal(isOutage(new NotFoundError('Instagram user not found')), false);+ assert.equal(isOutage(new UpstreamTimeoutError('Instagram'), AbortSignal.abort()), false);});test('for Instagram a Graph error code above 500, such as 506 for a duplicate post, is not mistaken for a server error', async () => {diff --git a/backend/tests/repositories/accountRepository.test.ts b/backend/tests/repositories/accountRepository.test.tsindex 7631867..9abda62 100644--- a/backend/tests/repositories/accountRepository.test.ts+++ b/backend/tests/repositories/accountRepository.test.ts@@ -8,6 +8,8 @@ import type { SupabaseClient } from '../../types/app.ts';const ROWS = [accountRow({ id: 'a1', platform: 'youtube', title: 'Mine' }),accountRow({ id: 'a2', platform: 'instagram', username: 'theirs' }, 'user-2'),+ // a platform Twiligent no longer supports; its rows stay in the table until they are cleaned up+ accountRow({ id: 'a3', platform: 'retired', username: 'old' }),];describe('account repository', () => {@@ -19,6 +21,13 @@ describe('account repository', () => {assert.deepEqual(await accounts.findById('a2'), { id: 'a2', platform: 'instagram', username: 'theirs' });});+ test('rows of a platform Twiligent no longer supports are never read', async () => {+ const accounts = createAccountRepository(fakeSupabase(ROWS));+ assert.deepEqual((await accounts.listForUser('user-1')).map(account => account.id), ['a1']);+ assert.equal(await accounts.findForUser('a3', 'user-1'), null);+ assert.equal(await accounts.findById('a3'), null);+ });+test('an update is one merge in the database that keeps the platform and the fields it does not name', async () => {const db = fakeSupabase(ROWS);const accounts = createAccountRepository(db);diff --git a/backend/tests/repositories/analyticsCacheRepository.test.ts b/backend/tests/repositories/analyticsCacheRepository.test.tsindex 680b7cd..a399bed 100644--- a/backend/tests/repositories/analyticsCacheRepository.test.ts+++ b/backend/tests/repositories/analyticsCacheRepository.test.ts@@ -4,7 +4,6 @@ import { createAnalyticsCacheRepository, resetCacheState } from '../../repositorimport type { Redis } from '../../types/app.ts';import type { VideosCacheData, YouTubeVideo } from '../../../shared/types/youtube.ts';import type { IGCacheData } from '../../../shared/types/instagram.ts';-import type { RedditCacheData } from '../../../shared/types/reddit.ts';type MemoryRedis = Redis & { store: Map<string, unknown> };@@ -31,7 +30,6 @@ test('every method is a no-op without redis', async () => {assert.equal(cache.enabled, false);assert.equal(await cache.getVideos('u', 'a'), null);assert.equal(await cache.getInstagramMedia('u', 'a'), null);- assert.equal(await cache.getReddit('u', 'a'), null);assert.equal(await cache.setVideos('u', 'a', {} as VideosCacheData), undefined);assert.equal(await cache.deleteAllForAccount('u', 'a'), undefined);});@@ -39,9 +37,9 @@ test('every method is a no-op without redis', async () => {test('redis failures fall back silently', async () => {const cache = createAnalyticsCacheRepository(failingRedis);assert.equal(await cache.getVideos('u', 'a'), null);- assert.equal(await cache.getReddit('u', 'a'), null);+ assert.equal(await cache.getInstagramMedia('u', 'a'), null);assert.equal(await cache.setVideos('u', 'a', { videos: [] } as unknown as VideosCacheData), undefined);- assert.equal(await cache.setReddit('u', 'a', {} as RedditCacheData), undefined);+ assert.equal(await cache.setInstagramMedia('u', 'a', { media: [] } as unknown as IGCacheData), undefined);assert.equal(await cache.deleteAllForAccount('u', 'a'), undefined);});@@ -69,13 +67,11 @@ test('deleting an account removes all three of its entries', async () => {const cache = createAnalyticsCacheRepository(redis);await cache.setInstagramMedia('u', 'a', { media: [] } as unknown as IGCacheData);await cache.setVideos('u', 'a', { videos: [] } as unknown as VideosCacheData);- await cache.setReddit('u', 'a', { posts: [] } as unknown as RedditCacheData);await cache.setVideos('u', 'other', { videos: [] } as unknown as VideosCacheData);await cache.deleteAllForAccount('u', 'a');assert.equal(await cache.getVideos('u', 'a'), null);assert.equal(await cache.getInstagramMedia('u', 'a'), null);- assert.equal(await cache.getReddit('u', 'a'), null);assert.deepEqual(await cache.getVideos('u', 'other'), { videos: [], version: 2 });});diff --git a/backend/tests/routes/analyticsRoutes.test.ts b/backend/tests/routes/analyticsRoutes.test.tsindex 7d58244..58d02fa 100644--- a/backend/tests/routes/analyticsRoutes.test.ts+++ b/backend/tests/routes/analyticsRoutes.test.ts@@ -37,8 +37,8 @@ const ACCOUNT_ROWS = [accountRow({ id: 'yt2', platform: 'youtube', channelId: 'UC2', uploadsPlaylistId: 'UU2', title: 'Beta', subscriberCount: 300, viewCount: 1000, videoCount: 0 }),accountRow({ id: 'yt3', platform: 'youtube', channelId: 'UC3', title: 'Gamma' }),accountRow({ id: 'ig1', platform: 'instagram', igUserId: 'IG1', accessToken: 'T1', username: 'ribbon' }),- accountRow({ id: 'rd1', platform: 'reddit', username: 'ribbon', cookie: 'COOKIE' }),- accountRow({ id: 'rd2', platform: 'reddit', username: 'nocookie' }),+ // a platform Twiligent no longer supports; the overview never reads its rows+ accountRow({ id: 'old1', platform: 'retired', username: 'old_profile' }),];const ROWS = [@@ -60,7 +60,6 @@ function cachedRedis() {'videos:user-1:yt1': { videos: CACHED_VIDEOS.yt1, fetchedAt: 'then', version: 2 },'videos:user-1:yt2': { videos: CACHED_VIDEOS.yt2, fetchedAt: 'then', version: 2 },'ig:user-1:ig1': { media: [{ id: 'm1', contentType: 'reel', likeCount: 5, commentsCount: 2, viewCount: 90 }, { id: 'm2', contentType: 'post', likeCount: 1, commentsCount: 0, viewCount: null }], version: 2 },- 'reddit:user-1:rd1': { analytics: { fetchedPosts: 4, totalScore: 40 } },};return fakeStore(store);}diff --git a/backend/tests/services/reddit/redditAnalytics.test.ts b/backend/tests/services/reddit/redditAnalytics.test.tsdeleted file mode 100644index 68fd180..0000000--- a/backend/tests/services/reddit/redditAnalytics.test.ts+++ /dev/null@@ -1,40 +0,0 @@-process.env.TZ = 'UTC';--import { test, describe, before, after, mock } from 'node:test';-import { computeRedditAnalytics } from '../../../services/reddit/redditAnalytics.ts';-import { assertGolden } from '../../fixtures/golden.ts';-import { FIXED_NOW, richPosts, zeroScorePosts, generatedPosts } from '../../fixtures/redditFixtures.ts';-import type { RedditProfile } from '../../../../shared/types/reddit.ts';--const profile = { username: 'ribbon', totalKarma: 900 } as RedditProfile;--describe('computeRedditAnalytics golden output', () => {- before(() => mock.timers.enable({ apis: ['Date'], now: FIXED_NOW }));- after(() => mock.timers.reset());-- test('empty and missing posts return the empty state', () => {- assertGolden({- empty: computeRedditAnalytics(profile, []),- missing: computeRedditAnalytics(profile, null),- }, 'redditAnalytics.empty');- });-- test('a varied account with a missing date, ties and a negative score', () => {- assertGolden(computeRedditAnalytics(profile, richPosts), 'redditAnalytics.rich');- });-- test('one and two posts cover the odd and even medians', () => {- assertGolden({- single: computeRedditAnalytics(profile, richPosts.slice(0, 1)),- pair: computeRedditAnalytics(profile, richPosts.slice(1, 3)),- }, 'redditAnalytics.small');- });-- test('posts that all scored zero', () => {- assertGolden(computeRedditAnalytics(profile, zeroScorePosts), 'redditAnalytics.zero');- });-- test('more than twenty subreddits', () => {- assertGolden(computeRedditAnalytics(profile, generatedPosts), 'redditAnalytics.generated');- });-});diff --git a/backend/tests/services/reddit/redditApi.test.ts b/backend/tests/services/reddit/redditApi.test.tsdeleted file mode 100644index 3e36240..0000000--- a/backend/tests/services/reddit/redditApi.test.ts+++ /dev/null@@ -1,86 +0,0 @@-import { test, describe, before, after, afterEach, mock } from 'node:test';-import { fetchRedditProfile, fetchRedditPosts, fetchTrackedPostData } from '../../../services/reddit/redditApi.ts';-import { assertGolden } from '../../fixtures/golden.ts';-import { installFetch, reply } from '../../fixtures/fakeFetch.ts';-import type { FetchMock } from '../../fixtures/fakeFetch.ts';-import { FIXED_NOW, rawRedditPosts } from '../../fixtures/redditFixtures.ts';--let fetchMock: FetchMock | null = null;-afterEach(() => fetchMock?.restore());--async function outcomeOf(promise: Promise<unknown>) {- try {- return { value: await promise };- } catch (err) {- return { error: (err as Error).message };- }-}--function listing(children: unknown[], after: string | null = null) {- return reply({ data: { children: children.map(data => ({ data })), after } });-}--describe('reddit api golden output', () => {- before(() => mock.timers.enable({ apis: ['Date'], now: FIXED_NOW }));- after(() => mock.timers.reset());-- test('maps a profile with and without optional fields', async () => {- const bodies = [- { data: { name: 'ribbon', total_karma: 900, link_karma: 600, comment_karma: 300, awardee_karma: 5, awarder_karma: 2, icon_img: 'https://i/a.png?x=1&y=2', created_utc: 1600000000, is_gold: true, is_mod: true, verified: true } },- { data: { name: 'plain', link_karma: 4, comment_karma: 6, snoovatar_img: 'https://i/s.png' } },- { data: { name: 'empty' } },- ];- fetchMock = installFetch((_request, count) => reply(bodies[count - 1]));- const profiles = [- await fetchRedditProfile('ribbon', 'COOKIE'),- await fetchRedditProfile('plain', ''),- await fetchRedditProfile('empty', null),- ];- assertGolden({ profiles, requests: fetchMock.requests }, 'reddit.profile');- });-- test('maps posts, follows pages and stops at the limit', async () => {- fetchMock = installFetch((request) => {- const after = new URL(request.url).searchParams.get('after');- if (!after) return listing(rawRedditPosts.slice(0, 3), 't3_c');- if (after === 't3_c') return listing(rawRedditPosts.slice(3), 't3_e');- return listing([]);- });- const posts = await fetchRedditPosts('ribbon', 'COOKIE');- const limited = await fetchRedditPosts('ribbon', 'COOKIE', 2);- assertGolden({ posts, limited, requests: fetchMock.requests }, 'reddit.posts');- });-- test('maps a tracked post and rejects bad links and responses', async () => {- const bodies = [- [{ data: { children: [{ data: { id: 'p1', title: 'Tracked', subreddit: 'webdev', score: 77, upvote_ratio: 0.93, num_comments: 8, permalink: '/r/webdev/comments/p1/tracked/', over_18: false, created_utc: 1785000000 } }] } }],- [{ data: { children: [{ data: { id: 'p2', title: 'Sparse', subreddit: 'misc', permalink: '/r/misc/comments/p2/' } }] } }],- { kind: 'Listing' },- [{ data: { children: [] } }],- ];- fetchMock = installFetch((_request, count) => reply(bodies[count - 1]));- const outcomes = [];- const links = [- 'https://www.reddit.com/r/webdev/comments/p1/tracked/',- 'https://old.reddit.com/r/misc/comments/p2',- 'https://reddit.com/r/misc/comments/p3/x/',- 'https://reddit.com/r/misc/comments/p4/x',- 'not a url',- 'https://example.com/r/misc/comments/p5/',- 'https://reddit.com/user/ribbon/',- ];- for (const link of links) outcomes.push(await outcomeOf(fetchTrackedPostData(link, 'COOKIE')));- assertGolden({ outcomes, requests: fetchMock.requests }, 'reddit.tracked');- });-- test('turns http failures and api errors into messages', async () => {- const script = [- reply({}, 404, 'Not Found'), reply({}, 403, 'Forbidden'), reply({}, 429, 'Too Many Requests'),- reply({}, 500, 'Server Error'), reply({ error: 400, message: 'Bad request' }), reply({ error: 401 }),- ];- fetchMock = installFetch((_request, count) => script[count - 1]);- const outcomes = [];- for (let i = 0; i < script.length; i++) outcomes.push(await outcomeOf(fetchRedditProfile('ribbon', 'COOKIE')));- assertGolden(outcomes, 'reddit.errors');- });-});