From c9fb412ae5278f24b88cfae8eee9adade5bb108b Mon Sep 17 00:00:00 2001 From: Justin Duke Date: Mon, 9 Sep 2024 16:05:47 -0400 Subject: [PATCH] Speed up e2e tests --- app/domain/[domain]/page.tsx | 4 +++- app/page.tsx | 10 +++++++--- .../[identifier]/and/[subidentifier]/page.tsx | 8 +++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/domain/[domain]/page.tsx b/app/domain/[domain]/page.tsx index 444065d..a2192f1 100644 --- a/app/domain/[domain]/page.tsx +++ b/app/domain/[domain]/page.tsx @@ -53,7 +53,9 @@ export default async function Page({ }; }) { const data = await fetch(params.domain); - await reify(params.domain, data); + if (!process.env.DISABLE_DATABASE) { + await reify(params.domain, data); + } return (
diff --git a/app/page.tsx b/app/page.tsx index dd1dd5c..b90899f 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -8,9 +8,13 @@ export const metadata = { }; export default async function Home() { - const data = await db - .selectFrom("detected_technologies") - .select(db.fn.countAll().as("count")) + const data = process.env.DISABLE_DATABASE + ? [{ + count: 0 + }] + : await db + .selectFrom("detected_technologies") + .select(db.fn.countAll().as("count")) .execute(); return ( diff --git a/app/technology/[identifier]/and/[subidentifier]/page.tsx b/app/technology/[identifier]/and/[subidentifier]/page.tsx index 5745c31..2a6d1bb 100644 --- a/app/technology/[identifier]/and/[subidentifier]/page.tsx +++ b/app/technology/[identifier]/and/[subidentifier]/page.tsx @@ -53,9 +53,11 @@ export default async function TechnologyAndPage({ return { data: data.slice(0, PAGE_SIZE), hasMore, total }; }); - const technologyCounts = await db - .selectFrom("detected_technologies") - .where( + const technologyCounts = process.env.DISABLE_DATABASE + ? [] + : await db + .selectFrom("detected_technologies") + .where( "domain", "in", db