diff --git a/.github/workflows/devs.yml b/.github/workflows/devs.yml index cc32d98..89082c6 100644 --- a/.github/workflows/devs.yml +++ b/.github/workflows/devs.yml @@ -37,6 +37,8 @@ jobs: NEXT_PUBLIC_APP_ENV=TEST DCUP_PARSER=http://localhost:9000 NEXTAUTH_URL=http://localhost:3000 + DROPBOX_CLIENT_ID=xxxxxxx + DROPBOX_CLIENT_SECRET=xxxxx REDIS_DB_ADDRESS=localhost REDIS_DB_PORT=6379 REDIS_DB_PASSWORD= diff --git a/DataSource/Dropbox/setDropboxConnection.ts b/DataSource/Dropbox/setDropboxConnection.ts index a7fd848..fa72429 100644 --- a/DataSource/Dropbox/setDropboxConnection.ts +++ b/DataSource/Dropbox/setDropboxConnection.ts @@ -3,7 +3,6 @@ import { connections } from "@/db/schemas/connections"; import { eq } from "drizzle-orm"; import { connectionConfig } from "../utils"; - export const setDropboxConnection = async (formData: FormData) => { const config = connectionConfig.safeParse({ connectionId: formData.get("connectionId"), diff --git a/app/api/connections/dropbox/callback/route.ts b/app/api/connections/dropbox/callback/route.ts index 3b68d5c..c14051f 100644 --- a/app/api/connections/dropbox/callback/route.ts +++ b/app/api/connections/dropbox/callback/route.ts @@ -104,6 +104,6 @@ export async function GET(request: Request) { } return NextResponse.redirect(`${process.env.NEXTAUTH_URL}/connections`); } catch (error) { - return NextResponse.json({ error: 'Failed to authenticate' }, { status: 500 }); + return NextResponse.json({ error: 'Failed to authenticate' }, { status: 401 }); } } diff --git a/app/layout.tsx b/app/layout.tsx index de90952..e2f5e2e 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -30,11 +30,11 @@ export const metadata: Metadata = { }; if (process.env.NEXT_PUBLIC_APP_ENV === 'TEST') { - if (!(global as any).__MSW_SERVER_STARTED__) { - console.log('🔧 MSW mock server starting...'); - mockServer.listen(); - (global as any).__MSW_SERVER_STARTED__ = true; - } + console.log('🔧🔧🔧 MSW mock server starting...🔧🔧🔧'); + mockServer.listen({ + onUnhandledRequest: 'bypass', + }); + (global as any).__MSW_SERVER_STARTED__ = true; } export default async function Layout({ children }: { children: ReactNode }) { diff --git a/components/ConfigConnection/ConfigConnection.tsx b/components/ConfigConnection/ConfigConnection.tsx index 94e46de..f49ee14 100644 --- a/components/ConfigConnection/ConfigConnection.tsx +++ b/components/ConfigConnection/ConfigConnection.tsx @@ -32,6 +32,7 @@ type ConnectionProps = { export const ConfigConnection = ({ connection, directory, status, open, setOpen, showPicker }: ConnectionProps) => { const [isConfigSet, setIsConfigSet] = useState(connection.isConfigSet) const [pending, startTransition] = useTransition() + const isTest = process.env.NEXT_PUBLIC_APP_ENV === 'TEST' // Service-specific text configuration const serviceLabels = { @@ -55,9 +56,15 @@ export const ConfigConnection = ({ connection, directory, status, open, setOpen, const handleSetConfig = (data: FormData) => { data.set("connectionId", connection.id) - data.set("folderName", directory.name) data.set("service", connection.service) + if (directory?.id) data.set("folderId", directory.id) + if (isTest) { + const folderName = data.get("folderName") + data.set("folderId", folderName || "") + } else { + data.set("folderName", directory.name) + } startTransition(async () => { const setConfig = async () => { try { @@ -121,11 +128,12 @@ export const ConfigConnection = ({ connection, directory, status, open, setOpen,