diff --git a/backend/src/__tests__/mocks/twitter-service.mock.ts b/backend/src/__tests__/mocks/twitter-service.mock.ts index c02e1b5..176374f 100644 --- a/backend/src/__tests__/mocks/twitter-service.mock.ts +++ b/backend/src/__tests__/mocks/twitter-service.mock.ts @@ -22,10 +22,14 @@ export class MockTwitterService extends TwitterService { logout: async () => {}, getCookies: async () => [], setCookies: async () => {}, - fetchSearchTweets: async (query: string, count: number, mode: SearchMode) => { + fetchSearchTweets: async ( + query: string, + count: number, + mode: SearchMode, + ) => { // Filter tweets that match the query (mentions @test_bot) - const matchingTweets = this.mockTweets.filter(tweet => - tweet.text?.includes("@test_bot") + const matchingTweets = this.mockTweets.filter((tweet) => + tweet.text?.includes("@test_bot"), ); // Sort by ID descending (newest first) to match Twitter search behavior @@ -87,7 +91,9 @@ export class MockTwitterService extends TwitterService { inReplyToStatusId: tweet.inReplyToStatusId, }; this.mockTweets.push(fullTweet); - logger.info(`Mock: Added tweet "${fullTweet.text}" from @${fullTweet.username}${tweet.inReplyToStatusId ? ` as reply to ${tweet.inReplyToStatusId}` : ''}`); + logger.info( + `Mock: Added tweet "${fullTweet.text}" from @${fullTweet.username}${tweet.inReplyToStatusId ? ` as reply to ${tweet.inReplyToStatusId}` : ""}`, + ); return fullTweet; } @@ -127,7 +133,7 @@ export class MockTwitterService extends TwitterService { const bId = BigInt(b.id); return bId > aId ? -1 : bId < aId ? 1 : 0; // Descending order (newest first) }) - .filter(tweet => { + .filter((tweet) => { const tweetId = BigInt(tweet.id); return !lastCheckedId || tweetId > lastCheckedId; }) @@ -139,9 +145,10 @@ export class MockTwitterService extends TwitterService { } // Filter for mentions - const newMentions = latestTweets.filter(tweet => - tweet.text?.includes("@test_bot") || - tweet.mentions?.some(m => m.username === "test_bot") + const newMentions = latestTweets.filter( + (tweet) => + tweet.text?.includes("@test_bot") || + tweet.mentions?.some((m) => m.username === "test_bot"), ); // Sort chronologically (oldest to newest) to match real service @@ -165,7 +172,7 @@ export class MockTwitterService extends TwitterService { this.testLastCheckedTweetId = tweetId; logger.info(`Last checked tweet ID updated to: ${tweetId}`); } - + async getTweet(tweetId: string): Promise { return this.mockTweets.find((t) => t.id === tweetId) || null; } diff --git a/backend/src/routes/test.ts b/backend/src/routes/test.ts index 981d9cd..58dcd50 100644 --- a/backend/src/routes/test.ts +++ b/backend/src/routes/test.ts @@ -6,7 +6,13 @@ import { MockTwitterService } from "../__tests__/mocks/twitter-service.mock"; const mockTwitterService = new MockTwitterService(); // Helper to create a tweet object -const createTweet = (id: string, text: string, username: string, inReplyToStatusId?: string, hashtags?: string[]): Tweet => { +const createTweet = ( + id: string, + text: string, + username: string, + inReplyToStatusId?: string, + hashtags?: string[], +): Tweet => { return { id, text, @@ -33,7 +39,13 @@ export const testRoutes = new Elysia({ prefix: "/api/test" }) }, }) .post("/tweets", async ({ body }) => { - const { id, text, username, inReplyToStatusId, hashtags } = body as { id: string; text: string; username: string; inReplyToStatusId?: string; hashtags?: string[] }; + const { id, text, username, inReplyToStatusId, hashtags } = body as { + id: string; + text: string; + username: string; + inReplyToStatusId?: string; + hashtags?: string[]; + }; const tweet = createTweet(id, text, username, inReplyToStatusId, hashtags); mockTwitterService.addMockTweet(tweet); return tweet; diff --git a/backend/src/services/config/config.service.ts b/backend/src/services/config/config.service.ts index ea34e6a..1248137 100644 --- a/backend/src/services/config/config.service.ts +++ b/backend/src/services/config/config.service.ts @@ -12,10 +12,16 @@ export class ConfigService { private constructor() { // Use test config in development mode if (process.env.NODE_ENV === "development") { - this.configPath = path.resolve(__dirname, "../../../../curate.config.test.json"); + this.configPath = path.resolve( + __dirname, + "../../../../curate.config.test.json", + ); logger.info("Using test configuration"); } else { - this.configPath = path.resolve(__dirname, "../../../../curate.config.json"); + this.configPath = path.resolve( + __dirname, + "../../../../curate.config.json", + ); logger.info("Using production configuration"); } } diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.ts index a50ac82..29d83b1 100644 --- a/frontend/src/routeTree.gen.ts +++ b/frontend/src/routeTree.gen.ts @@ -10,111 +10,111 @@ // Import Routes -import { Route as rootRoute } from './routes/__root' -import { Route as TestImport } from './routes/test' -import { Route as SettingsImport } from './routes/settings' -import { Route as IndexImport } from './routes/index' -import { Route as FeedFeedIdImport } from './routes/feed.$feedId' +import { Route as rootRoute } from "./routes/__root"; +import { Route as TestImport } from "./routes/test"; +import { Route as SettingsImport } from "./routes/settings"; +import { Route as IndexImport } from "./routes/index"; +import { Route as FeedFeedIdImport } from "./routes/feed.$feedId"; // Create/Update Routes const TestRoute = TestImport.update({ - id: '/test', - path: '/test', + id: "/test", + path: "/test", getParentRoute: () => rootRoute, -} as any) +} as any); const SettingsRoute = SettingsImport.update({ - id: '/settings', - path: '/settings', + id: "/settings", + path: "/settings", getParentRoute: () => rootRoute, -} as any) +} as any); const IndexRoute = IndexImport.update({ - id: '/', - path: '/', + id: "/", + path: "/", getParentRoute: () => rootRoute, -} as any) +} as any); const FeedFeedIdRoute = FeedFeedIdImport.update({ - id: '/feed/$feedId', - path: '/feed/$feedId', + id: "/feed/$feedId", + path: "/feed/$feedId", getParentRoute: () => rootRoute, -} as any) +} as any); // Populate the FileRoutesByPath interface -declare module '@tanstack/react-router' { +declare module "@tanstack/react-router" { interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexImport - parentRoute: typeof rootRoute - } - '/settings': { - id: '/settings' - path: '/settings' - fullPath: '/settings' - preLoaderRoute: typeof SettingsImport - parentRoute: typeof rootRoute - } - '/test': { - id: '/test' - path: '/test' - fullPath: '/test' - preLoaderRoute: typeof TestImport - parentRoute: typeof rootRoute - } - '/feed/$feedId': { - id: '/feed/$feedId' - path: '/feed/$feedId' - fullPath: '/feed/$feedId' - preLoaderRoute: typeof FeedFeedIdImport - parentRoute: typeof rootRoute - } + "/": { + id: "/"; + path: "/"; + fullPath: "/"; + preLoaderRoute: typeof IndexImport; + parentRoute: typeof rootRoute; + }; + "/settings": { + id: "/settings"; + path: "/settings"; + fullPath: "/settings"; + preLoaderRoute: typeof SettingsImport; + parentRoute: typeof rootRoute; + }; + "/test": { + id: "/test"; + path: "/test"; + fullPath: "/test"; + preLoaderRoute: typeof TestImport; + parentRoute: typeof rootRoute; + }; + "/feed/$feedId": { + id: "/feed/$feedId"; + path: "/feed/$feedId"; + fullPath: "/feed/$feedId"; + preLoaderRoute: typeof FeedFeedIdImport; + parentRoute: typeof rootRoute; + }; } } // Create and export the route tree export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/settings': typeof SettingsRoute - '/test': typeof TestRoute - '/feed/$feedId': typeof FeedFeedIdRoute + "/": typeof IndexRoute; + "/settings": typeof SettingsRoute; + "/test": typeof TestRoute; + "/feed/$feedId": typeof FeedFeedIdRoute; } export interface FileRoutesByTo { - '/': typeof IndexRoute - '/settings': typeof SettingsRoute - '/test': typeof TestRoute - '/feed/$feedId': typeof FeedFeedIdRoute + "/": typeof IndexRoute; + "/settings": typeof SettingsRoute; + "/test": typeof TestRoute; + "/feed/$feedId": typeof FeedFeedIdRoute; } export interface FileRoutesById { - __root__: typeof rootRoute - '/': typeof IndexRoute - '/settings': typeof SettingsRoute - '/test': typeof TestRoute - '/feed/$feedId': typeof FeedFeedIdRoute + __root__: typeof rootRoute; + "/": typeof IndexRoute; + "/settings": typeof SettingsRoute; + "/test": typeof TestRoute; + "/feed/$feedId": typeof FeedFeedIdRoute; } export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/settings' | '/test' | '/feed/$feedId' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/settings' | '/test' | '/feed/$feedId' - id: '__root__' | '/' | '/settings' | '/test' | '/feed/$feedId' - fileRoutesById: FileRoutesById + fileRoutesByFullPath: FileRoutesByFullPath; + fullPaths: "/" | "/settings" | "/test" | "/feed/$feedId"; + fileRoutesByTo: FileRoutesByTo; + to: "/" | "/settings" | "/test" | "/feed/$feedId"; + id: "__root__" | "/" | "/settings" | "/test" | "/feed/$feedId"; + fileRoutesById: FileRoutesById; } export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - SettingsRoute: typeof SettingsRoute - TestRoute: typeof TestRoute - FeedFeedIdRoute: typeof FeedFeedIdRoute + IndexRoute: typeof IndexRoute; + SettingsRoute: typeof SettingsRoute; + TestRoute: typeof TestRoute; + FeedFeedIdRoute: typeof FeedFeedIdRoute; } const rootRouteChildren: RootRouteChildren = { @@ -122,11 +122,11 @@ const rootRouteChildren: RootRouteChildren = { SettingsRoute: SettingsRoute, TestRoute: TestRoute, FeedFeedIdRoute: FeedFeedIdRoute, -} +}; export const routeTree = rootRoute ._addFileChildren(rootRouteChildren) - ._addFileTypes() + ._addFileTypes(); /* ROUTE_MANIFEST_START { diff --git a/frontend/src/routes/test.tsx b/frontend/src/routes/test.tsx index 65eb680..4209d16 100644 --- a/frontend/src/routes/test.tsx +++ b/frontend/src/routes/test.tsx @@ -8,7 +8,9 @@ export const Route = createFileRoute("/test")({ function TestPage() { const [selectedFeed, setSelectedFeed] = useState("test"); - const [submissionTweetId, setSubmissionTweetId] = useState(null); + const [submissionTweetId, setSubmissionTweetId] = useState( + null, + ); const [tweetText, setTweetText] = useState(""); const [username, setUsername] = useState("curator");