Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,56 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { readFileSync, statSync } from "node:fs";
|
||||
import { gzipSync } from "node:zlib";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { dirname, join } from "node:path";
|
||||
|
||||
const here = dirname(fileURLToPath(import.meta.url));
|
||||
const sdkPath = join(here, "..", "public", "embed", "marketing.js");
|
||||
|
||||
describe("marketing.js SDK", () => {
|
||||
it("is checked into apps/web/public/embed/marketing.js", () => {
|
||||
expect(statSync(sdkPath).isFile()).toBe(true);
|
||||
});
|
||||
|
||||
it("stays under the 3KB gzipped budget", () => {
|
||||
const raw = readFileSync(sdkPath);
|
||||
const gz = gzipSync(raw);
|
||||
expect(gz.byteLength).toBeLessThan(3 * 1024);
|
||||
});
|
||||
|
||||
it("stays under the 5KB raw budget", () => {
|
||||
const raw = readFileSync(sdkPath);
|
||||
expect(raw.byteLength).toBeLessThan(5 * 1024);
|
||||
});
|
||||
|
||||
it("references the capture endpoint path", () => {
|
||||
const text = readFileSync(sdkPath, "utf8");
|
||||
expect(text).toContain("/api/leads/capture");
|
||||
});
|
||||
|
||||
it("exposes the toolctrlMarketing global with the documented surface", () => {
|
||||
const text = readFileSync(sdkPath, "utf8");
|
||||
expect(text).toContain("toolctrlMarketing");
|
||||
expect(text).toContain("captureLead");
|
||||
expect(text).toContain("bindFormById");
|
||||
expect(text).toContain("getAttribution");
|
||||
});
|
||||
|
||||
it("auto-captures the documented UTM/click-id parameters", () => {
|
||||
const text = readFileSync(sdkPath, "utf8");
|
||||
for (const k of ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content", "gclid", "fbclid"]) {
|
||||
expect(text).toContain(k);
|
||||
}
|
||||
});
|
||||
|
||||
it("persists first-touch attribution in localStorage", () => {
|
||||
const text = readFileSync(sdkPath, "utf8");
|
||||
expect(text).toContain("localStorage");
|
||||
expect(text).toContain("__tcm_attr");
|
||||
});
|
||||
|
||||
it("includes a honeypot field name compatible with the capture endpoint", () => {
|
||||
const text = readFileSync(sdkPath, "utf8");
|
||||
expect(text).toContain("website_url");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user