docs: use @ocas/ prefix consistently in test names, comments, and error messages
This commit is contained in:
@@ -67,7 +67,7 @@ function envValue(json: string): unknown {
|
||||
}
|
||||
|
||||
describe("@ Alias Resolution - put", () => {
|
||||
test("ocas put @string <file> should resolve alias", async () => {
|
||||
test("ocas put @ocas/string <file> should resolve alias", async () => {
|
||||
await runCliAlias("init");
|
||||
|
||||
const payloadFile = join(testDir, "payload.json");
|
||||
@@ -85,7 +85,7 @@ describe("@ Alias Resolution - put", () => {
|
||||
expect(envValue(stdout)).toMatch(/^[0-9A-HJKMNP-TV-Z]{13}$/);
|
||||
});
|
||||
|
||||
test("ocas put @number <file> should resolve alias", async () => {
|
||||
test("ocas put @ocas/number <file> should resolve alias", async () => {
|
||||
await runCliAlias("init");
|
||||
|
||||
const payloadFile = join(testDir, "payload.json");
|
||||
@@ -101,7 +101,7 @@ describe("@ Alias Resolution - put", () => {
|
||||
expect(envValue(stdout)).toMatch(/^[0-9A-HJKMNP-TV-Z]{13}$/);
|
||||
});
|
||||
|
||||
test("ocas put @object <file> should resolve alias", async () => {
|
||||
test("ocas put @ocas/object <file> should resolve alias", async () => {
|
||||
await runCliAlias("init");
|
||||
|
||||
const payloadFile = join(testDir, "payload.json");
|
||||
@@ -133,7 +133,7 @@ describe("@ Alias Resolution - put", () => {
|
||||
expect(stderr.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test("ocas put @schema with nested type constraints should succeed", async () => {
|
||||
test("ocas put @ocas/schema with nested type constraints should succeed", async () => {
|
||||
await runCliAlias("init");
|
||||
|
||||
const schemaFile = join(testDir, "constrained-schema.json");
|
||||
@@ -168,7 +168,7 @@ describe("@ Alias Resolution - put", () => {
|
||||
});
|
||||
|
||||
describe("@ Alias Resolution - hash", () => {
|
||||
test("ocas hash @string <file> should compute hash without storing", async () => {
|
||||
test("ocas hash @ocas/string <file> should compute hash without storing", async () => {
|
||||
await runCliAlias("init");
|
||||
|
||||
const payloadFile = join(testDir, "payload.json");
|
||||
|
||||
@@ -19,7 +19,7 @@ afterEach(() => {
|
||||
|
||||
describe("list-meta CLI command", () => {
|
||||
test("E1. list-meta on bootstrapped store contains exactly the meta-schema hash", async () => {
|
||||
// First, get @schema hash by calling has on it (also triggers bootstrap)
|
||||
// First, get @ocas/schema hash by calling has on it (also triggers bootstrap)
|
||||
const { stdout: hashOut, exitCode: hashCode } = await runCli(
|
||||
["hash", "@ocas/schema", "--pipe"],
|
||||
storePath,
|
||||
@@ -28,7 +28,7 @@ describe("list-meta CLI command", () => {
|
||||
void hashOut;
|
||||
void hashCode;
|
||||
|
||||
// Bootstrap fully via 'list --type @schema'
|
||||
// Bootstrap fully via 'list --type @ocas/schema'
|
||||
const { stdout: schemaListOut } = await runCli(
|
||||
["list", "--type", "@ocas/schema"],
|
||||
storePath,
|
||||
@@ -119,7 +119,7 @@ describe("F1. output schemas registered", () => {
|
||||
});
|
||||
|
||||
describe("E4. list-schema vs list --type with multiple meta-schema versions", () => {
|
||||
test("list-schema includes schemas typed by older meta-schemas; list --type @schema does not", async () => {
|
||||
test("list-schema includes schemas typed by older meta-schemas; list --type @ocas/schema does not", async () => {
|
||||
// Set up two distinct meta-schemas via the library
|
||||
const store = await openFsStore(storePath);
|
||||
const m1 = await store[BOOTSTRAP_STORE]({
|
||||
|
||||
@@ -101,7 +101,7 @@ describe("Phase 8: Pipe Composition", () => {
|
||||
expect(stdout).toContain("Bob");
|
||||
});
|
||||
|
||||
test("8.3 list --type @schema emits a parseable envelope of hashes", async () => {
|
||||
test("8.3 list --type @ocas/schema emits a parseable envelope of hashes", async () => {
|
||||
const { stdout, exitCode } = await runCli([
|
||||
"list",
|
||||
"--type",
|
||||
@@ -117,7 +117,7 @@ describe("Phase 8: Pipe Composition", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("8.4 list --type @schema | render -p expands the schema list", async () => {
|
||||
test("8.4 list --type @ocas/schema | render -p expands the schema list", async () => {
|
||||
const { stdout: listOut } = await runCli([
|
||||
"list",
|
||||
"--type",
|
||||
|
||||
@@ -60,7 +60,7 @@ async function runCli(
|
||||
}
|
||||
|
||||
describe("Phase 1: CAS Core", () => {
|
||||
test("1.1 init + put with @object bootstraps store", async () => {
|
||||
test("1.1 init + put with @ocas/object bootstraps store", async () => {
|
||||
expect(typeHash).toMatch(/^[0-9A-HJKMNP-TV-Z]{13}$/);
|
||||
});
|
||||
|
||||
|
||||
@@ -421,7 +421,7 @@ describe("Suite 6: CLI Integration with Templates", () => {
|
||||
try {
|
||||
await runCli(["init"], tmpStore);
|
||||
|
||||
// Get @string type hash via bootstrap
|
||||
// Get @ocas/string type hash via bootstrap
|
||||
const store = createFsStore(tmpStore);
|
||||
const types = await bootstrap(store);
|
||||
const stringType = types["@ocas/string"];
|
||||
@@ -456,7 +456,7 @@ describe("Suite 6: CLI Integration with Templates", () => {
|
||||
try {
|
||||
await runCli(["init"], tmpStore);
|
||||
|
||||
// Get @string type hash via bootstrap
|
||||
// Get @ocas/string type hash via bootstrap
|
||||
const store = createFsStore(tmpStore);
|
||||
const types = await bootstrap(store);
|
||||
const stringType = types["@ocas/string"];
|
||||
|
||||
@@ -76,7 +76,7 @@ async function runCli(...args: string[]): Promise<{
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bootstrap @string type hash
|
||||
* Get bootstrap @ocas/string type hash
|
||||
*/
|
||||
async function getStringHash(store: Store): Promise<Hash> {
|
||||
const builtinSchemas = await bootstrap(store);
|
||||
|
||||
@@ -61,12 +61,12 @@ describe("bootstrap - Built-in Schemas", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("should register @schema as meta-schema alias", async () => {
|
||||
test("should register @ocas/schema as meta-schema alias", async () => {
|
||||
const store = createMemoryStore();
|
||||
const builtinSchemas = await bootstrap(store);
|
||||
|
||||
const metaHash = builtinSchemas["@ocas/schema"];
|
||||
if (!metaHash) throw new Error("@schema not found");
|
||||
if (!metaHash) throw new Error("@ocas/schema not found");
|
||||
|
||||
const metaSchema = getSchema(store, metaHash);
|
||||
expect(metaSchema).not.toBeNull();
|
||||
@@ -74,45 +74,45 @@ describe("bootstrap - Built-in Schemas", () => {
|
||||
expect(metaSchema?.description).toBe("ocas JSON Schema meta-schema");
|
||||
});
|
||||
|
||||
test("should register @string schema correctly", async () => {
|
||||
test("should register @ocas/string schema correctly", async () => {
|
||||
const store = createMemoryStore();
|
||||
const builtinSchemas = await bootstrap(store);
|
||||
|
||||
const stringHash = builtinSchemas["@ocas/string"];
|
||||
if (!stringHash) throw new Error("@string not found");
|
||||
if (!stringHash) throw new Error("@ocas/string not found");
|
||||
|
||||
const stringSchema = getSchema(store, stringHash);
|
||||
expect(stringSchema).toEqual({ type: "string" });
|
||||
});
|
||||
|
||||
test("should register @number schema correctly", async () => {
|
||||
test("should register @ocas/number schema correctly", async () => {
|
||||
const store = createMemoryStore();
|
||||
const builtinSchemas = await bootstrap(store);
|
||||
|
||||
const numberHash = builtinSchemas["@ocas/number"];
|
||||
if (!numberHash) throw new Error("@number not found");
|
||||
if (!numberHash) throw new Error("@ocas/number not found");
|
||||
|
||||
const numberSchema = getSchema(store, numberHash);
|
||||
expect(numberSchema).toEqual({ type: "number" });
|
||||
});
|
||||
|
||||
test("should register @object schema correctly", async () => {
|
||||
test("should register @ocas/object schema correctly", async () => {
|
||||
const store = createMemoryStore();
|
||||
const builtinSchemas = await bootstrap(store);
|
||||
|
||||
const objectHash = builtinSchemas["@ocas/object"];
|
||||
if (!objectHash) throw new Error("@object not found");
|
||||
if (!objectHash) throw new Error("@ocas/object not found");
|
||||
|
||||
const objectSchema = getSchema(store, objectHash);
|
||||
expect(objectSchema).toEqual({ type: "object" });
|
||||
});
|
||||
|
||||
test("should register @array schema correctly", async () => {
|
||||
test("should register @ocas/array schema correctly", async () => {
|
||||
const store = createMemoryStore();
|
||||
const builtinSchemas = await bootstrap(store);
|
||||
|
||||
const arrayHash = builtinSchemas["@ocas/array"];
|
||||
if (!arrayHash) throw new Error("@array not found");
|
||||
if (!arrayHash) throw new Error("@ocas/array not found");
|
||||
|
||||
const arraySchema = getSchema(store, arrayHash);
|
||||
expect(arraySchema).toEqual({ type: "array" });
|
||||
@@ -150,7 +150,7 @@ describe("bootstrap - Built-in Schemas", () => {
|
||||
const builtinSchemas = await bootstrap(store);
|
||||
|
||||
const metaHash = builtinSchemas["@ocas/schema"];
|
||||
if (!metaHash) throw new Error("@schema not found");
|
||||
if (!metaHash) throw new Error("@ocas/schema not found");
|
||||
|
||||
for (const [alias, hash] of Object.entries(builtinSchemas)) {
|
||||
if (alias === "@ocas/schema") continue; // meta-schema is self-typed
|
||||
|
||||
@@ -65,7 +65,7 @@ describe("registerOutputTemplates", () => {
|
||||
await registerOutputTemplates(store, varStore);
|
||||
|
||||
const stringHash = aliases["@ocas/string"];
|
||||
if (!stringHash) throw new Error("@string not found");
|
||||
if (!stringHash) throw new Error("@ocas/string not found");
|
||||
|
||||
for (const alias of OUTPUT_ALIASES) {
|
||||
const schemaHash = aliases[alias];
|
||||
@@ -105,7 +105,7 @@ describe("registerOutputTemplates", () => {
|
||||
const putHash = aliases["@ocas/output/put"];
|
||||
if (!putHash) throw new Error("@ocas/output/put not found");
|
||||
const stringHash = aliases["@ocas/string"];
|
||||
if (!stringHash) throw new Error("@string not found");
|
||||
if (!stringHash) throw new Error("@ocas/string not found");
|
||||
|
||||
const variable = varStore.get(`@ocas/template/text/${putHash}`, stringHash);
|
||||
if (variable === null)
|
||||
|
||||
@@ -58,7 +58,7 @@ const DEFAULT_TEMPLATES: ReadonlyArray<
|
||||
|
||||
/**
|
||||
* Register default LiquidJS templates for all @ocas/output/* schemas.
|
||||
* Each template is stored as a @string CAS node and bound to
|
||||
* Each template is stored as a @ocas/string CAS node and bound to
|
||||
* the variable `@ocas/template/text/<schema-hash>`.
|
||||
*
|
||||
* Idempotent: safe to call multiple times.
|
||||
@@ -70,7 +70,7 @@ export async function registerOutputTemplates(
|
||||
const aliases = await bootstrap(store);
|
||||
const stringHash = aliases["@ocas/string"];
|
||||
if (stringHash === undefined) {
|
||||
throw new Error("@string schema not found in bootstrap result");
|
||||
throw new Error("@ocas/string schema not found in bootstrap result");
|
||||
}
|
||||
|
||||
const registered: Record<string, Hash> = {};
|
||||
|
||||
@@ -39,7 +39,7 @@ describe("wrapEnvelope", () => {
|
||||
expect(envelope.value).toEqual(gcStats);
|
||||
});
|
||||
|
||||
test("resolves primitive alias @string", async () => {
|
||||
test("resolves primitive alias @ocas/string", async () => {
|
||||
const store = createMemoryStore();
|
||||
const aliases = await bootstrap(store);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user