-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnext.config.test.ts
More file actions
27 lines (24 loc) · 961 Bytes
/
Copy pathnext.config.test.ts
File metadata and controls
27 lines (24 loc) · 961 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { describe, expect, it } from "vitest";
import nextConfig from "./next.config";
describe("next config", () => {
it("blocks streamed metadata for preview crawlers without matching browsers", () => {
const htmlLimitedBots = nextConfig.htmlLimitedBots;
expect(htmlLimitedBots).toBeInstanceOf(RegExp);
expect(htmlLimitedBots?.test("TelegramBot")).toBe(true);
expect(htmlLimitedBots?.test("WebpageBot")).toBe(true);
expect(htmlLimitedBots?.test("Bingbot")).toBe(true);
expect(
htmlLimitedBots?.test(
"Googlebot/2.1 (+http://www.google.com/bot.html)",
),
).toBe(true);
expect(htmlLimitedBots?.test("GPTBot")).toBe(true);
expect(htmlLimitedBots?.test("OAI-SearchBot")).toBe(true);
expect(htmlLimitedBots?.test("ChatGPT-User")).toBe(true);
expect(
htmlLimitedBots?.test(
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
),
).toBe(false);
});
});