Skip to content
Myr

answer-runs.test.ts

This file

Path

apps/platform/test/answer-runs.test.ts

45 lines · 1.5 KiB · TypeScript

Last changed by

Merge build/comments-platform into mainoscabrielbefore adoptionddf09e8

History of this file

Take it

Merge build/comments-platform into mainoscabrielbefore adoptionddf09e8

lines 1–2why, one step back
1// The engine refuses an instance id past 100 characters, and starting an id that
2// exists changes nothing.

Close the code browser and drafting wave: its decisions in two ADRs, every rule it added held, and its leftovers folded inoscabrielbefore adoption009640c

lines 3–16why, one step back
3import { describe, expect, it } from "@effect/vitest";
4import { CommitSha, LayerName, ProjectName } from "@repo/protocol/ids";56import { AdmissionParams, admissionId } from "../src/answer-runs.ts";78const INSTANCE_ID = /^[a-zA-Z0-9_][a-zA-Z0-9-_]*$/u;910describe("an admission's instance", () => {11 it("is the project, layer and head, whole, when they fit", () => {12 expect(13 admissionId(14 AdmissionParams.make({15 head: CommitSha.make("a".repeat(40)),16 layer: LayerName.make("maintainers"),

Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8

line 17why, one step back
17 project: ProjectName.make("alice/datekit"),

Close the code browser and drafting wave: its decisions in two ADRs, every rule it added held, and its leftovers folded inoscabrielbefore adoption009640c

lines 18–19why, one step back
18 })
19 )

Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8

line 20why, one step back
20 ).toBe(`admit-alice__datekit-maintainers-${"a".repeat(40)}`);

Close the code browser and drafting wave: its decisions in two ADRs, every rule it added held, and its leftovers folded inoscabrielbefore adoption009640c

lines 21–23why, one step back
21 });
2223 it("keeps each pushed head its own instance under a long project and layer name, within the engine's 100 characters", () => {

Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8

lines 24–27why, one step back
24 const project = ProjectName.make(
25 `alice/${"a-long-project-name".repeat(3)}x`26 );27

Close the code browser and drafting wave: its decisions in two ADRs, every rule it added held, and its leftovers folded inoscabrielbefore adoption009640c

lines 28–45why, one step back
28 const layer = LayerName.make("maintainers-of-the-sealed-suites");
2930 const heads = [31 CommitSha.make(`${"1".repeat(39)}a`),32 CommitSha.make(`${"1".repeat(39)}b`),33 ];3435 const ids = heads.map((head) =>36 admissionId(AdmissionParams.make({ head, layer, project }))37 );3839 expect({40 distinct: new Set(ids).size,41 fit: ids.every((id) => id.length <= 100 && INSTANCE_ID.test(id)),42 named: heads.every((head, at) => (ids[at] ?? "").endsWith(`-${head}`)),43 }).toStrictEqual({ distinct: 2, fit: true, named: true });44 });45});