This commit is contained in:
@@ -55,4 +55,25 @@ describe("public rendering performance", () => {
|
||||
sitemap: "https://guide.example.test/sitemap.xml",
|
||||
});
|
||||
});
|
||||
|
||||
it("loads AdSense only after confirming the visitor is signed out", async () => {
|
||||
const [adsense, home, guide, guideSection, adsTxt] = await Promise.all([
|
||||
repositoryFile("components/public/google-adsense.tsx"),
|
||||
repositoryFile("app/page.tsx"),
|
||||
repositoryFile("app/[character]/page.tsx"),
|
||||
repositoryFile("app/[character]/[page]/page.tsx"),
|
||||
repositoryFile("public/ads.txt"),
|
||||
]);
|
||||
|
||||
expect(adsense).toContain("authClient.useSession()");
|
||||
expect(adsense).toContain('process.env.NODE_ENV !== "production"');
|
||||
expect(adsense).toMatch(/isPending \|\|\s+error \|\|\s+session/u);
|
||||
expect(adsense).toContain("pagead2.googlesyndication.com");
|
||||
expect(home).toContain("<GoogleAdsense />");
|
||||
expect(guide).toContain("<GoogleAdsense />");
|
||||
expect(guideSection).toContain("<GoogleAdsense />");
|
||||
expect(adsTxt.trim()).toBe(
|
||||
"google.com, pub-9687404323559597, DIRECT, f08c47fec0942fa0",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user