refactor: strip Phase/Plan/R-number references from source comments
This commit is contained in:
@@ -44,80 +44,79 @@ export const CONTRACT_PAGES_SEED: Page[] = [
|
||||
* must return a repo pre-loaded with CONTRACT_PAGES_SEED (two pages:
|
||||
* one published with slug "about", one draft with slug "draft-page").
|
||||
*/
|
||||
export const pagesRepositoryContract =
|
||||
defineContractSuite<IPagesRepository>(
|
||||
"IPagesRepository",
|
||||
({ buildSubject, getTracer }) => {
|
||||
let repo: IPagesRepository;
|
||||
export const pagesRepositoryContract = defineContractSuite<IPagesRepository>(
|
||||
"IPagesRepository",
|
||||
({ buildSubject, getTracer }) => {
|
||||
let repo: IPagesRepository;
|
||||
|
||||
beforeEach(async () => {
|
||||
repo = await buildSubject();
|
||||
beforeEach(async () => {
|
||||
repo = await buildSubject();
|
||||
});
|
||||
|
||||
// --- getPageBySlug ---
|
||||
|
||||
it("getPageBySlug returns the published page by slug", async () => {
|
||||
const result = await repo.getPageBySlug("about");
|
||||
expect(result).toBeDefined();
|
||||
expect(result?.slug).toBe("about");
|
||||
expect(result?.status).toBe("published");
|
||||
expect(result?.id).toBeDefined();
|
||||
});
|
||||
|
||||
it("getPageBySlug returns undefined for an unknown slug", async () => {
|
||||
expect(await repo.getPageBySlug("no-such-page")).toBeUndefined();
|
||||
});
|
||||
|
||||
// --- getPages ---
|
||||
|
||||
it("getPages with no filter returns all seeded pages", async () => {
|
||||
const list = await repo.getPages();
|
||||
expect(list).toHaveLength(2);
|
||||
for (const page of list) {
|
||||
expect(page.id).toBeDefined();
|
||||
expect(page.slug).toBeDefined();
|
||||
expect(["draft", "published"]).toContain(page.status);
|
||||
}
|
||||
});
|
||||
|
||||
it("getPages({ status: 'published' }) returns only published pages", async () => {
|
||||
const published = await repo.getPages({ status: "published" });
|
||||
expect(published).toHaveLength(1);
|
||||
for (const page of published) {
|
||||
expect(page.status).toBe("published");
|
||||
}
|
||||
});
|
||||
|
||||
it("getPages({ status: 'draft' }) returns only draft pages", async () => {
|
||||
const drafts = await repo.getPages({ status: "draft" });
|
||||
expect(drafts).toHaveLength(1);
|
||||
for (const page of drafts) {
|
||||
expect(page.status).toBe("draft");
|
||||
}
|
||||
});
|
||||
|
||||
describe("span emission", () => {
|
||||
it("getPageBySlug emits pages.getPageBySlug span with slug attribute", async () => {
|
||||
if (!getTracer) return;
|
||||
const tracer = getTracer();
|
||||
tracer.reset();
|
||||
await repo.getPageBySlug("about");
|
||||
const span = tracer.findSpan("pages.getPageBySlug");
|
||||
expect(span).toBeDefined();
|
||||
expect(span!.op).toBe("repository");
|
||||
expect(span!.attributes.slug).toBe("about");
|
||||
});
|
||||
|
||||
// --- getPageBySlug ---
|
||||
|
||||
it("getPageBySlug returns the published page by slug", async () => {
|
||||
const result = await repo.getPageBySlug("about");
|
||||
expect(result).toBeDefined();
|
||||
expect(result?.slug).toBe("about");
|
||||
expect(result?.status).toBe("published");
|
||||
expect(result?.id).toBeDefined();
|
||||
it("getPages emits pages.getPages span with op=repository", async () => {
|
||||
if (!getTracer) return;
|
||||
const tracer = getTracer();
|
||||
tracer.reset();
|
||||
await repo.getPages({ status: "published" });
|
||||
const span = tracer.findSpan("pages.getPages");
|
||||
expect(span).toBeDefined();
|
||||
expect(span!.op).toBe("repository");
|
||||
expect(span!.attributes.status).toBe("published");
|
||||
});
|
||||
|
||||
it("getPageBySlug returns undefined for an unknown slug", async () => {
|
||||
expect(await repo.getPageBySlug("no-such-page")).toBeUndefined();
|
||||
});
|
||||
|
||||
// --- getPages ---
|
||||
|
||||
it("getPages with no filter returns all seeded pages", async () => {
|
||||
const list = await repo.getPages();
|
||||
expect(list).toHaveLength(2);
|
||||
for (const page of list) {
|
||||
expect(page.id).toBeDefined();
|
||||
expect(page.slug).toBeDefined();
|
||||
expect(["draft", "published"]).toContain(page.status);
|
||||
}
|
||||
});
|
||||
|
||||
it("getPages({ status: 'published' }) returns only published pages", async () => {
|
||||
const published = await repo.getPages({ status: "published" });
|
||||
expect(published).toHaveLength(1);
|
||||
for (const page of published) {
|
||||
expect(page.status).toBe("published");
|
||||
}
|
||||
});
|
||||
|
||||
it("getPages({ status: 'draft' }) returns only draft pages", async () => {
|
||||
const drafts = await repo.getPages({ status: "draft" });
|
||||
expect(drafts).toHaveLength(1);
|
||||
for (const page of drafts) {
|
||||
expect(page.status).toBe("draft");
|
||||
}
|
||||
});
|
||||
|
||||
describe("span emission (R50)", () => {
|
||||
it("getPageBySlug emits pages.getPageBySlug span with slug attribute", async () => {
|
||||
if (!getTracer) return;
|
||||
const tracer = getTracer();
|
||||
tracer.reset();
|
||||
await repo.getPageBySlug("about");
|
||||
const span = tracer.findSpan("pages.getPageBySlug");
|
||||
expect(span).toBeDefined();
|
||||
expect(span!.op).toBe("repository");
|
||||
expect(span!.attributes.slug).toBe("about");
|
||||
});
|
||||
|
||||
it("getPages emits pages.getPages span with op=repository", async () => {
|
||||
if (!getTracer) return;
|
||||
const tracer = getTracer();
|
||||
tracer.reset();
|
||||
await repo.getPages({ status: "published" });
|
||||
const span = tracer.findSpan("pages.getPages");
|
||||
expect(span).toBeDefined();
|
||||
expect(span!.op).toBe("repository");
|
||||
expect(span!.attributes.status).toBe("published");
|
||||
});
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
@@ -35,7 +35,7 @@ export const siteSettingsRepositoryContract =
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
describe("span emission (R50)", () => {
|
||||
describe("span emission", () => {
|
||||
it("getSiteSettings emits site-settings.getSiteSettings span with op=repository", async () => {
|
||||
if (!getTracer) return;
|
||||
const tracer = getTracer();
|
||||
|
||||
Reference in New Issue
Block a user