mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-11-29 15:51:52 +00:00
* OpenABTest 0.2-draft: goal conversions 0.1 conversions are purchases with a price, so button, onboarding and landing-page experiments had nothing conformant to report. 0.2 adds a goal conversion: metrics.conversion "unique-participants-with-goal" with metrics.goal, metrics.profit "none", and conversion events carrying exactly one of price or goal (optional observed value). Backward compatible: every 0.1 document stays valid; goal forms require "0.2-draft". The reference implementation is w3bs.org/ab-testing. @logicsrc/schemas and @logicsrc/validators 0.5.0, @logicsrc/sdk 0.4.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * contract: accept any 0.x draft status (OpenABTest is 0.2) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
45 lines
2.3 KiB
TypeScript
45 lines
2.3 KiB
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
import { familyOfSpec } from "../src/lib/specs";
|
|
import { listDocs, readDoc } from "../src/lib/docs";
|
|
import { GET as llms } from "../src/app/llms.txt/route";
|
|
import { GET as llmsFull } from "../src/app/llms-full.txt/route";
|
|
import sitemap from "../src/app/sitemap";
|
|
|
|
// Spec discovery must work even when the optional blog database is offline.
|
|
vi.mock("../src/lib/supabase", () => ({ publicClient: () => { throw new Error("offline"); } }));
|
|
|
|
describe.each([
|
|
{ slug: "openagent", name: "OpenAgent", family: "people" },
|
|
{ slug: "openskill", name: "OpenSkill", family: "people" },
|
|
{ slug: "openabtest", name: "OpenABTest", family: "process" },
|
|
{ slug: "openfleet", name: "OpenFleet", family: "process" },
|
|
{ slug: "openrental", name: "OpenRental", family: "catalogs" },
|
|
{ slug: "openmodel", name: "OpenModel", family: "catalogs" },
|
|
{ slug: "openwall", name: "OpenWall", family: "people" },
|
|
{ slug: "openobject", name: "OpenObject", family: "catalogs" },
|
|
{ slug: "openslice", name: "OpenSlice", family: "catalogs" },
|
|
{ slug: "openstack", name: "OpenStack.md", family: "catalogs" },
|
|
{ slug: "openinstall", name: "OpenInstall", family: "process" },
|
|
{ slug: "openerrand", name: "OpenErrand", family: "process" }
|
|
])("$name public discovery", ({ slug, name, family }) => {
|
|
it("serves the specification through its family and docs index", () => {
|
|
expect(familyOfSpec(slug)?.slug).toBe(family);
|
|
expect(listDocs()).toContainEqual(expect.objectContaining({ slug, title: name }));
|
|
expect(readDoc(slug)).toMatch(/Status: \*{0,2}0\.\d/);
|
|
});
|
|
|
|
it("includes a reachable docs URL and the full contract in the LLM feeds", async () => {
|
|
// A spec with a landing page is linked there and cites its docs URL after
|
|
// it; a docs-only spec is linked straight to /docs/<slug>. Both must name
|
|
// the docs URL somewhere on the line.
|
|
const text = await llms().text();
|
|
expect(text).toMatch(new RegExp(`\\[${name}\\]\\(https://[^)]+/(docs/)?${slug}\\)`));
|
|
expect(text).toContain(`/docs/${slug}`);
|
|
expect(await llmsFull().text()).toContain(readDoc(slug)!.trim());
|
|
});
|
|
|
|
it("includes the docs route in the sitemap without a blog connection", async () => {
|
|
const entries = await sitemap();
|
|
expect(entries.some((entry) => new URL(entry.url).pathname === `/docs/${slug}`)).toBe(true);
|
|
});
|
|
});
|