diff --git a/tests/aspect_test.affine b/tests/aspect_test.affine index b5d5fb4..5b3e65a 100644 --- a/tests/aspect_test.affine +++ b/tests/aspect_test.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module aspect_test; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // @@ -22,13 +19,13 @@ import { assertMatch, } from "jsr:@std/assert@^1"; -const REPO_ROOT = new URL("../", import.meta.url).pathname; +let REPO_ROOT = new URL("../", import.meta.url).pathname; -async function readFile(relPath: string): Promise { +async fn readFile(relPath: string): string | null { return Deno.readTextFile(REPO_ROOT + relPath).catch(() => null); } -async function pathExists(relPath: string): Promise { +async fn pathExists(relPath: string): boolean { return Deno.stat(REPO_ROOT + relPath).then(() => true).catch(() => false); } @@ -41,10 +38,10 @@ Deno.test("aspect/security: SECURITY.md exists", async () => { }); Deno.test("aspect/security: SECURITY.md mentions vulnerability disclosure", async () => { - const content = await readFile("SECURITY.md"); + let content = await readFile("SECURITY.md"); assertNotEquals(content, null); - const lc = content!.toLowerCase(); - const hasDisclosure = + let lc = content!.toLowerCase(); + let hasDisclosure = lc.includes("vulnerabilit") || lc.includes("disclosure") || lc.includes("report") || @@ -58,15 +55,15 @@ Deno.test("aspect/security: .well-known/security.txt exists", async () => { Deno.test("aspect/security: no .env files in repo", async () => { // Checks common secret leak patterns - const exists = await pathExists(".env"); + let exists = await pathExists(".env"); assertEquals(exists, false, ".env file must not be committed"); }); Deno.test("aspect/security: no plaintext secrets patterns in README", async () => { - const content = await readFile("README.adoc"); + let content = await readFile("README.adoc"); assertNotEquals(content, null); // Check for obvious secret patterns (API_KEY=, PASSWORD=, TOKEN=) - const hasSecretLeak = /(?:api_key|password|secret|token)\s*=/i.test(content!); + let hasSecretLeak = /(?:api_key|password|secret|token)\s*=/i.test(content!); assertEquals(hasSecretLeak, false, "README.adoc must not contain hardcoded secrets"); }); @@ -79,7 +76,7 @@ Deno.test("aspect/community: CODE_OF_CONDUCT.md exists", async () => { }); Deno.test("aspect/community: CODE_OF_CONDUCT.md is non-trivial", async () => { - const content = await readFile("CODE_OF_CONDUCT.md"); + let content = await readFile("CODE_OF_CONDUCT.md"); assertNotEquals(content, null); assertEquals(content!.length > 100, true, "CODE_OF_CONDUCT.md should have meaningful content"); }); @@ -93,13 +90,13 @@ Deno.test("aspect/formatting: .editorconfig exists", async () => { }); Deno.test("aspect/formatting: .editorconfig has root = true", async () => { - const content = await readFile(".editorconfig"); + let content = await readFile(".editorconfig"); assertNotEquals(content, null); assertMatch(content!, /root\s*=\s*true/i); }); Deno.test("aspect/formatting: .editorconfig defines indent_style", async () => { - const content = await readFile(".editorconfig"); + let content = await readFile(".editorconfig"); assertNotEquals(content, null); assertMatch(content!, /indent_style\s*=/); }); @@ -108,7 +105,7 @@ Deno.test("aspect/formatting: .editorconfig defines indent_style", async () => { // Aspect: No banned file patterns // --------------------------------------------------------------------------- -const BANNED_FILES = [ +let BANNED_FILES = [ "package.json", // Node/npm — banned "package-lock.json", "yarn.lock", @@ -120,7 +117,7 @@ const BANNED_FILES = [ for (const f of BANNED_FILES) { Deno.test(`aspect/policy: banned file must not exist — ${f}`, async () => { - const exists = await pathExists(f); + let exists = await pathExists(f); assertEquals(exists, false, `Banned file/directory present: ${f}`); }); } @@ -137,7 +134,7 @@ Deno.test("aspect/language: no tsconfig.json (TS only via Deno, not tsc)", async // Aspect: Documentation is accessible (all .adoc files are non-empty) // --------------------------------------------------------------------------- -const DOCS = [ +let DOCS = [ "README.adoc", "EXPLAINME.adoc", "CONTRIBUTING.md", @@ -146,7 +143,7 @@ const DOCS = [ for (const doc of DOCS) { Deno.test(`aspect/docs: documentation file is non-empty — ${doc}`, async () => { - const content = await readFile(doc); + let content = await readFile(doc); assertNotEquals(content, null, `Doc missing: ${doc}`); assertEquals(content!.trim().length > 50, true, `Doc is too short: ${doc}`); }); @@ -157,10 +154,10 @@ for (const doc of DOCS) { // --------------------------------------------------------------------------- Deno.test("aspect/tests: all non-bench .ts files in tests/ use Deno.test", async () => { - const testsDir = REPO_ROOT + "tests"; + let testsDir = REPO_ROOT + "tests"; for await (const entry of Deno.readDir(testsDir)) { if (entry.isFile && entry.name.endsWith(".ts") && !entry.name.includes("bench")) { - const content = await Deno.readTextFile(`${testsDir}/${entry.name}`); + let content = await Deno.readTextFile(`${testsDir}/${entry.name}`); assertMatch( content, /Deno\.test\s*\(/, @@ -170,4 +167,3 @@ Deno.test("aspect/tests: all non-bench .ts files in tests/ use Deno.test", async } }); -==================================== */ diff --git a/tests/bench_test.affine b/tests/bench_test.affine index c181c4e..7faef99 100644 --- a/tests/bench_test.affine +++ b/tests/bench_test.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module bench_test; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // @@ -18,7 +15,7 @@ module bench_test; // // Run with: deno bench tests/bench_test.ts -const REPO_ROOT = new URL("../", import.meta.url).pathname; +let REPO_ROOT = new URL("../", import.meta.url).pathname; // --------------------------------------------------------------------------- // Bench: file reading throughput @@ -53,7 +50,7 @@ Deno.bench({ // Bench: SPDX regex matching // --------------------------------------------------------------------------- -const sampleContent = `# SPDX-License-Identifier: MPL-2.0 +let sampleContent = `# SPDX-License-Identifier: MPL-2.0 # Copyright (c) 2026 Jonathan D.A. Jewell [metadata] @@ -111,7 +108,7 @@ Deno.bench({ // Bench: JSON parse (proxy for metadata parsing workload) // --------------------------------------------------------------------------- -const jsonSample = JSON.stringify({ +let jsonSample = JSON.stringify({ project: "thunderbird-template-reloaded", version: "0.1.0", crg_grade: "C", @@ -139,4 +136,3 @@ Deno.bench({ }, }); -==================================== */ diff --git a/tests/contract_test.affine b/tests/contract_test.affine index 224531c..630c853 100644 --- a/tests/contract_test.affine +++ b/tests/contract_test.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module contract_test; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // @@ -13,7 +10,7 @@ module contract_test; // // Contract tests verify the repo fulfils its stated obligations to consumers // and integrators: RSR (Rhodium Standard Repository) compliance, Hypatia CI -// contract, and the gitbot-fleet interface contract. +// contract, and the gitbot-fleet struct contract. // Run with: deno test tests/contract_test.ts import { @@ -23,13 +20,13 @@ import { assertStringIncludes, } from "jsr:@std/assert@^1"; -const REPO_ROOT = new URL("../", import.meta.url).pathname; +let REPO_ROOT = new URL("../", import.meta.url).pathname; -async function readFile(relPath: string): Promise { +async fn readFile(relPath: string): string | null { return Deno.readTextFile(REPO_ROOT + relPath).catch(() => null); } -async function pathExists(relPath: string): Promise { +async fn pathExists(relPath: string): boolean { return Deno.stat(REPO_ROOT + relPath).then(() => true).catch(() => false); } @@ -54,18 +51,18 @@ Deno.test("contract/RSR: AGENTIC.a2ml exists in .machine_readable/6a2/", async ( }); Deno.test("contract/RSR: no SCM checkpoint files in repo root", async () => { - const bannedRootFiles = ["STATE.scm", "META.scm", "ECOSYSTEM.scm", "AGENTIC.scm"]; + let bannedRootFiles = ["STATE.scm", "META.scm", "ECOSYSTEM.scm", "AGENTIC.scm"]; for (const f of bannedRootFiles) { - const exists = await pathExists(f); + let exists = await pathExists(f); assertEquals(exists, false, `SCM checkpoint file must NOT be in repo root: ${f}`); } }); Deno.test("contract/RSR: no SCM checkpoint files exist anywhere", async () => { // RSR invariant: .machine_readable/ must use .a2ml, never .scm - const bannedNames = ["STATE.scm", "META.scm", "ECOSYSTEM.scm", "AGENTIC.scm"]; + let bannedNames = ["STATE.scm", "META.scm", "ECOSYSTEM.scm", "AGENTIC.scm"]; for (const f of bannedNames) { - const exists = await pathExists(`.machine_readable/${f}`); + let exists = await pathExists(`.machine_readable/${f}`); assertEquals(exists, false, `SCM file found in .machine_readable/ — must use .a2ml: ${f}`); } }); @@ -83,7 +80,7 @@ Deno.test("contract/RSR: ABI-FFI-README.md is present", async () => { // --------------------------------------------------------------------------- Deno.test("contract/license: LICENSE file uses PMPL", async () => { - const content = await readFile("LICENSE"); + let content = await readFile("LICENSE"); assertNotEquals(content, null, "LICENSE must exist"); // PMPL license text contains "Palimpsest" assertStringIncludes( @@ -98,7 +95,7 @@ Deno.test("contract/license: LICENSES/MPL-2.0.txt present", async () => { }); Deno.test("contract/license: README.adoc has SPDX header", async () => { - const content = await readFile("README.adoc"); + let content = await readFile("README.adoc"); assertNotEquals(content, null); assertMatch(content!, /SPDX-License-Identifier:/); }); @@ -120,10 +117,10 @@ Deno.test("contract/hypatia: .hypatia/last-visit.json exists", async () => { // --------------------------------------------------------------------------- Deno.test("contract/author: MAINTAINERS.adoc references Jonathan D.A. Jewell", async () => { - const content = await readFile("MAINTAINERS.adoc"); + let content = await readFile("MAINTAINERS.adoc"); assertNotEquals(content, null, "MAINTAINERS.adoc must exist"); // Should contain the canonical author name or hyperpolymath handle - const hasAuthor = content!.includes("Jonathan") || content!.includes("hyperpolymath"); + let hasAuthor = content!.includes("Jonathan") || content!.includes("hyperpolymath"); assertEquals(hasAuthor, true, "MAINTAINERS.adoc should reference the author"); }); @@ -136,7 +133,7 @@ Deno.test("contract/stapeln: stapeln.toml exists", async () => { }); Deno.test("contract/stapeln: stapeln.toml is non-empty", async () => { - const content = await readFile("stapeln.toml"); + let content = await readFile("stapeln.toml"); assertNotEquals(content, null); assertNotEquals(content!.trim(), ""); }); @@ -153,4 +150,3 @@ Deno.test("contract/contractiles: MUST.contractile exists in .machine_readable/" assertEquals(await pathExists(".machine_readable/MUST.contractile"), true); }); -==================================== */ diff --git a/tests/e2e_test.affine b/tests/e2e_test.affine index 097efaa..a8ccc7b 100644 --- a/tests/e2e_test.affine +++ b/tests/e2e_test.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module e2e_test; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // @@ -24,14 +21,14 @@ import { } from "jsr:@std/assert@^1"; import { join } from "jsr:@std/path@^1"; -const REPO_ROOT = new URL("../", import.meta.url).pathname; +let REPO_ROOT = new URL("../", import.meta.url).pathname; // --------------------------------------------------------------------------- // E2E: Reflexive — this test file has correct SPDX header // --------------------------------------------------------------------------- Deno.test("e2e/reflexive: this test file carries MPL-2.0 header", async () => { - const content = await Deno.readTextFile( + let content = await Deno.readTextFile( REPO_ROOT + "tests/e2e_test.ts", ); assertMatch(content, /SPDX-License-Identifier:\s*PMPL-1\.0-or-later/); @@ -42,10 +39,10 @@ Deno.test("e2e/reflexive: this test file carries MPL-2.0 header", async () => { // --------------------------------------------------------------------------- Deno.test("e2e/reflexive: all test .ts files have SPDX headers", async () => { - const testsDir = REPO_ROOT + "tests"; + let testsDir = REPO_ROOT + "tests"; for await (const entry of Deno.readDir(testsDir)) { if (entry.isFile && entry.name.endsWith(".ts")) { - const content = await Deno.readTextFile(`${testsDir}/${entry.name}`); + let content = await Deno.readTextFile(`${testsDir}/${entry.name}`); assertMatch( content, /SPDX-License-Identifier:/, @@ -59,7 +56,7 @@ Deno.test("e2e/reflexive: all test .ts files have SPDX headers", async () => { // E2E: CI hook scripts exist and are syntactically non-empty // --------------------------------------------------------------------------- -const EXPECTED_HOOKS = [ +let EXPECTED_HOOKS = [ "hooks/validate-codeql.sh", "hooks/validate-permissions.sh", "hooks/validate-sha-pins.sh", @@ -68,7 +65,7 @@ const EXPECTED_HOOKS = [ for (const hook of EXPECTED_HOOKS) { Deno.test(`e2e: CI hook file exists — ${hook}`, async () => { - const content = await Deno.readTextFile(REPO_ROOT + hook).catch(() => null); + let content = await Deno.readTextFile(REPO_ROOT + hook).catch(() => null); assertNotEquals(content, null, `Hook missing: ${hook}`); assertNotEquals(content!.trim(), "", `Hook is empty: ${hook}`); }); @@ -79,7 +76,7 @@ for (const hook of EXPECTED_HOOKS) { // --------------------------------------------------------------------------- Deno.test("e2e: TOPOLOGY.md exists", async () => { - const content = await Deno.readTextFile(REPO_ROOT + "TOPOLOGY.md").catch(() => null); + let content = await Deno.readTextFile(REPO_ROOT + "TOPOLOGY.md").catch(() => null); assertNotEquals(content, null, "TOPOLOGY.md must exist"); }); @@ -88,7 +85,7 @@ Deno.test("e2e: TOPOLOGY.md exists", async () => { // --------------------------------------------------------------------------- Deno.test("e2e: NOTICE file is present and non-trivial", async () => { - const content = await Deno.readTextFile(REPO_ROOT + "NOTICE").catch(() => null); + let content = await Deno.readTextFile(REPO_ROOT + "NOTICE").catch(() => null); assertNotEquals(content, null, "NOTICE must exist"); assertNotEquals(content!.trim(), "", "NOTICE must not be empty"); }); @@ -98,7 +95,7 @@ Deno.test("e2e: NOTICE file is present and non-trivial", async () => { // --------------------------------------------------------------------------- Deno.test("e2e: Justfile contains a 'test' recipe", async () => { - const content = await Deno.readTextFile(REPO_ROOT + "Justfile").catch(() => null); + let content = await Deno.readTextFile(REPO_ROOT + "Justfile").catch(() => null); assertNotEquals(content, null, "Justfile must exist"); assertStringIncludes(content!, "test", "Justfile should have a test recipe"); }); @@ -108,8 +105,8 @@ Deno.test("e2e: Justfile contains a 'test' recipe", async () => { // --------------------------------------------------------------------------- Deno.test("e2e: deno.json or import map is present for Deno deps", async () => { - const hasDeno = await Deno.stat(REPO_ROOT + "deno.json").then(() => true).catch(() => false); - const hasImportMap = await Deno.stat(REPO_ROOT + "import_map.json").then(() => true).catch(() => false); + let hasDeno = await Deno.stat(REPO_ROOT + "deno.json").then(() => true).catch(() => false); + let hasImportMap = await Deno.stat(REPO_ROOT + "import_map.json").then(() => true).catch(() => false); // For scaffold repos, neither may exist yet — this is a soft check // We verify the test infrastructure itself knows about Deno assertEquals( @@ -123,7 +120,7 @@ Deno.test("e2e: deno.json or import map is present for Deno deps", async () => { // E2E: QUICKSTART guides exist (user, dev, maintainer) // --------------------------------------------------------------------------- -const QUICKSTART_FILES = [ +let QUICKSTART_FILES = [ "QUICKSTART-USER.adoc", "QUICKSTART-DEV.adoc", "QUICKSTART-MAINTAINER.adoc", @@ -131,7 +128,7 @@ const QUICKSTART_FILES = [ for (const qs of QUICKSTART_FILES) { Deno.test(`e2e: quickstart guide present — ${qs}`, async () => { - const exists = await Deno.stat(REPO_ROOT + qs).then(() => true).catch(() => false); + let exists = await Deno.stat(REPO_ROOT + qs).then(() => true).catch(() => false); assertEquals(exists, true, `Missing quickstart guide: ${qs}`); }); } @@ -141,8 +138,7 @@ for (const qs of QUICKSTART_FILES) { // --------------------------------------------------------------------------- Deno.test("e2e: CITATION.cff exists", async () => { - const exists = await Deno.stat(REPO_ROOT + "CITATION.cff").then(() => true).catch(() => false); + let exists = await Deno.stat(REPO_ROOT + "CITATION.cff").then(() => true).catch(() => false); assertEquals(exists, true, "CITATION.cff must exist"); }); -==================================== */ diff --git a/tests/property_test.affine b/tests/property_test.affine index 574d418..0ed1713 100644 --- a/tests/property_test.affine +++ b/tests/property_test.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module property_test; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // @@ -19,17 +16,17 @@ module property_test; import { assertEquals, assertNotEquals, assertMatch } from "jsr:@std/assert@^1"; -const REPO_ROOT = new URL("../", import.meta.url).pathname; +let REPO_ROOT = new URL("../", import.meta.url).pathname; // --------------------------------------------------------------------------- // Property: all .a2ml files have SPDX header // --------------------------------------------------------------------------- -async function collectA2mlFiles(dir: string): Promise { +async fn collectA2mlFiles(dir: string): string[] { const result: string[] = []; try { for await (const entry of Deno.readDir(dir)) { - const full = `${dir}/${entry.name}`; + let full = `${dir}/${entry.name}`; if (entry.isDirectory) { result.push(...await collectA2mlFiles(full)); } else if (entry.name.endsWith(".a2ml")) { @@ -43,19 +40,19 @@ async function collectA2mlFiles(dir: string): Promise { } Deno.test("property: every .a2ml file has SPDX-License-Identifier header", async () => { - const files = await collectA2mlFiles(REPO_ROOT + ".machine_readable"); + let files = await collectA2mlFiles(REPO_ROOT + ".machine_readable"); // also check root manifest files.push(REPO_ROOT + "0-AI-MANIFEST.a2ml"); // Some scaffold files may not yet carry SPDX headers; // exclude them from this check until they are updated upstream. - const SPDX_EXEMPT = ["ANCHOR.a2ml", "0-AI-MANIFEST.a2ml"]; + let SPDX_EXEMPT = ["ANCHOR.a2ml", "0-AI-MANIFEST.a2ml"]; for (const file of files) { - const basename = file.split("/").pop() ?? ""; + let basename = file.split("/").pop() ?? ""; if (SPDX_EXEMPT.includes(basename)) continue; - const content = await Deno.readTextFile(file); - const hasSpdx = /SPDX-License-Identifier:/.test(content); + let content = await Deno.readTextFile(file); + let hasSpdx = /SPDX-License-Identifier:/.test(content); assertEquals(hasSpdx, true, `Missing SPDX header in ${file}`); } }); @@ -65,12 +62,12 @@ Deno.test("property: every .a2ml file has SPDX-License-Identifier header", async // --------------------------------------------------------------------------- Deno.test("property: all .a2ml files use MPL-2.0", async () => { - const files = await collectA2mlFiles(REPO_ROOT + ".machine_readable"); + let files = await collectA2mlFiles(REPO_ROOT + ".machine_readable"); files.push(REPO_ROOT + "0-AI-MANIFEST.a2ml"); for (const file of files) { - const content = await Deno.readTextFile(file); - const match = content.match(/SPDX-License-Identifier:\s*(\S+)/); + let content = await Deno.readTextFile(file); + let match = content.match(/SPDX-License-Identifier:\s*(\S+)/); if (match) { assertEquals( match[1], @@ -86,12 +83,12 @@ Deno.test("property: all .a2ml files use MPL-2.0", async () => { // --------------------------------------------------------------------------- Deno.test("property: all hook scripts have bash/sh shebang", async () => { - const hooksDir = REPO_ROOT + "hooks"; + let hooksDir = REPO_ROOT + "hooks"; try { for await (const entry of Deno.readDir(hooksDir)) { if (entry.isFile && entry.name.endsWith(".sh")) { - const content = await Deno.readTextFile(`${hooksDir}/${entry.name}`); - const firstLine = content.split("\n")[0]; + let content = await Deno.readTextFile(`${hooksDir}/${entry.name}`); + let firstLine = content.split("\n")[0]; assertEquals( firstLine.startsWith("#!"), true, @@ -109,7 +106,7 @@ Deno.test("property: all hook scripts have bash/sh shebang", async () => { // --------------------------------------------------------------------------- // Generate a variety of comment styles and ensure extraction is consistent -const commentStyles = [ +let commentStyles = [ ["# SPDX-License-Identifier: MPL-2.0", "MPL-2.0"], ["// SPDX-License-Identifier: MPL-2.0", "MPL-2.0"], ["/* SPDX-License-Identifier: MPL-2.0 */", "MIT"], @@ -119,7 +116,7 @@ const commentStyles = [ for (const [input, expected] of commentStyles) { Deno.test(`property: SPDX extraction handles comment style "${input.slice(0, 20)}..."`, () => { - const match = input.match(/SPDX-License-Identifier:\s*(\S+)/); + let match = input.match(/SPDX-License-Identifier:\s*(\S+)/); assertNotEquals(match, null, `Should extract SPDX ID from: ${input}`); assertEquals(match![1], expected); }); @@ -130,11 +127,11 @@ for (const [input, expected] of commentStyles) { // --------------------------------------------------------------------------- Deno.test("property: k9 example files are present and non-empty", async () => { - const k9ExamplesDir = REPO_ROOT + "contractiles/k9/examples"; + let k9ExamplesDir = REPO_ROOT + "contractiles/k9/examples"; try { for await (const entry of Deno.readDir(k9ExamplesDir)) { if (entry.isFile) { - const content = await Deno.readTextFile(`${k9ExamplesDir}/${entry.name}`); + let content = await Deno.readTextFile(`${k9ExamplesDir}/${entry.name}`); assertNotEquals(content.trim(), "", `K9 example ${entry.name} must not be empty`); } } @@ -147,7 +144,7 @@ Deno.test("property: k9 example files are present and non-empty", async () => { // Property: contractile files (Dustfile, Mustfile, Intentfile) are present // --------------------------------------------------------------------------- -const contractileFiles = [ +let contractileFiles = [ "contractiles/dust/Dustfile", "contractiles/must/Mustfile", "contractiles/lust/Intentfile", @@ -156,7 +153,7 @@ const contractileFiles = [ for (const f of contractileFiles) { Deno.test(`property: contractile file exists and non-empty — ${f}`, async () => { try { - const content = await Deno.readTextFile(REPO_ROOT + f); + let content = await Deno.readTextFile(REPO_ROOT + f); assertNotEquals(content.trim(), "", `${f} must not be empty`); } catch { // file does not exist — report as failure @@ -170,8 +167,8 @@ for (const f of contractileFiles) { // --------------------------------------------------------------------------- Deno.test("property: README.adoc contains at least 3 AsciiDoc section headings", async () => { - const content = await Deno.readTextFile(REPO_ROOT + "README.adoc"); - const headings = content.match(/^={1,6}\s+.+/gm) ?? []; + let content = await Deno.readTextFile(REPO_ROOT + "README.adoc"); + let headings = content.match(/^={1,6}\s+.+/gm) ?? []; assertEquals( headings.length >= 3, true, @@ -179,4 +176,3 @@ Deno.test("property: README.adoc contains at least 3 AsciiDoc section headings", ); }); -==================================== */ diff --git a/tests/smoke_test.affine b/tests/smoke_test.affine index 503bbab..149497b 100644 --- a/tests/smoke_test.affine +++ b/tests/smoke_test.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module smoke_test; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // @@ -18,9 +15,9 @@ module smoke_test; import { assertEquals, assertNotEquals } from "jsr:@std/assert@^1"; -const REPO_ROOT = new URL("../", import.meta.url).pathname; +let REPO_ROOT = new URL("../", import.meta.url).pathname; -async function pathExists(relPath: string): Promise { +async fn pathExists(relPath: string): boolean { try { await Deno.stat(REPO_ROOT + relPath); return true; @@ -29,9 +26,9 @@ async function pathExists(relPath: string): Promise { } } -async function isDirectory(relPath: string): Promise { +async fn isDirectory(relPath: string): boolean { try { - const info = await Deno.stat(REPO_ROOT + relPath); + let info = await Deno.stat(REPO_ROOT + relPath); return info.isDirectory; } catch { return false; @@ -42,7 +39,7 @@ async function isDirectory(relPath: string): Promise { // Smoke: top-level required files // --------------------------------------------------------------------------- -const REQUIRED_FILES = [ +let REQUIRED_FILES = [ "LICENSE", "README.adoc", "EXPLAINME.adoc", @@ -62,7 +59,7 @@ const REQUIRED_FILES = [ for (const file of REQUIRED_FILES) { Deno.test(`smoke: required file exists — ${file}`, async () => { - const exists = await pathExists(file); + let exists = await pathExists(file); assertEquals(exists, true, `Required file missing: ${file}`); }); } @@ -71,7 +68,7 @@ for (const file of REQUIRED_FILES) { // Smoke: required directories // --------------------------------------------------------------------------- -const REQUIRED_DIRS = [ +let REQUIRED_DIRS = [ ".machine_readable", ".machine_readable/6a2", "tests", @@ -89,7 +86,7 @@ const REQUIRED_DIRS = [ for (const dir of REQUIRED_DIRS) { Deno.test(`smoke: required directory exists — ${dir}`, async () => { - const isDir = await isDirectory(dir); + let isDir = await isDirectory(dir); assertEquals(isDir, true, `Required directory missing: ${dir}`); }); } @@ -98,7 +95,7 @@ for (const dir of REQUIRED_DIRS) { // Smoke: machine-readable checkpoint files // --------------------------------------------------------------------------- -const A2ML_FILES = [ +let A2ML_FILES = [ ".machine_readable/6a2/STATE.a2ml", ".machine_readable/6a2/META.a2ml", ".machine_readable/6a2/ECOSYSTEM.a2ml", @@ -109,7 +106,7 @@ const A2ML_FILES = [ for (const f of A2ML_FILES) { Deno.test(`smoke: a2ml checkpoint exists — ${f}`, async () => { - const exists = await pathExists(f); + let exists = await pathExists(f); assertEquals(exists, true, `A2ML file missing: ${f}`); }); } @@ -118,7 +115,7 @@ for (const f of A2ML_FILES) { // Smoke: .well-known files // --------------------------------------------------------------------------- -const WELL_KNOWN = [ +let WELL_KNOWN = [ ".well-known/security.txt", ".well-known/ai.txt", ".well-known/humans.txt", @@ -126,7 +123,7 @@ const WELL_KNOWN = [ for (const f of WELL_KNOWN) { Deno.test(`smoke: well-known file exists — ${f}`, async () => { - const exists = await pathExists(f); + let exists = await pathExists(f); assertEquals(exists, true, `Well-known file missing: ${f}`); }); } @@ -152,7 +149,7 @@ Deno.test("smoke: FFI integration_test.zig exists", async () => { // --------------------------------------------------------------------------- Deno.test("smoke: SECURITY.md is non-empty", async () => { - const content = await Deno.readTextFile(REPO_ROOT + "SECURITY.md"); + let content = await Deno.readTextFile(REPO_ROOT + "SECURITY.md"); assertNotEquals(content.trim(), ""); }); @@ -161,8 +158,8 @@ Deno.test("smoke: SECURITY.md is non-empty", async () => { // --------------------------------------------------------------------------- Deno.test("smoke: README.adoc mentions thunderbird", async () => { - const content = await Deno.readTextFile(REPO_ROOT + "README.adoc"); - const lc = content.toLowerCase(); + let content = await Deno.readTextFile(REPO_ROOT + "README.adoc"); + let lc = content.toLowerCase(); assertEquals( lc.includes("thunderbird"), true, @@ -170,4 +167,3 @@ Deno.test("smoke: README.adoc mentions thunderbird", async () => { ); }); -==================================== */ diff --git a/tests/unit_test.affine b/tests/unit_test.affine index 81e45f3..22f7caf 100644 --- a/tests/unit_test.affine +++ b/tests/unit_test.affine @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MPL-2.0 -// Ported via Harvard Engine mechanical processor +// Ported via Harvard Engine (Semantic pass) module unit_test; -// TODO: Complete semantic implementation - -/* === ORIGINAL TYPESCRIPT CONTEXT === // SPDX-License-Identifier: MPL-2.0 // Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) // @@ -17,14 +14,14 @@ module unit_test; import { assertEquals, assertMatch, assertNotEquals } from "jsr:@std/assert@^1"; -const REPO_ROOT = new URL("../", import.meta.url).pathname; +let REPO_ROOT = new URL("../", import.meta.url).pathname; // --------------------------------------------------------------------------- // Helper utilities // --------------------------------------------------------------------------- /** Read a file relative to the repo root. Returns null if absent. */ -async function readFile(relPath: string): Promise { +async fn readFile(relPath: string): string | null { try { return await Deno.readTextFile(REPO_ROOT + relPath); } catch { @@ -33,7 +30,7 @@ async function readFile(relPath: string): Promise { } /** Check whether a path exists (file or directory). */ -async function pathExists(relPath: string): Promise { +async fn pathExists(relPath: string): boolean { try { await Deno.stat(REPO_ROOT + relPath); return true; @@ -43,8 +40,8 @@ async function pathExists(relPath: string): Promise { } /** Extract the SPDX identifier from file content. Returns null if not found. */ -function extractSpdxId(content: string): string | null { - const match = content.match(/SPDX-License-Identifier:\s*(\S+)/); +fn extractSpdxId(content: string): string | null { + let match = content.match(/SPDX-License-Identifier:\s*(\S+)/); return match ? match[1] : null; } @@ -53,12 +50,12 @@ function extractSpdxId(content: string): string | null { // --------------------------------------------------------------------------- Deno.test("unit: extractSpdxId parses valid SPDX line", () => { - const content = "// SPDX-License-Identifier: MPL-2.0\ncode"; + let content = "// SPDX-License-Identifier: MPL-2.0\ncode"; assertEquals(extractSpdxId(content), "MPL-2.0"); }); Deno.test("unit: extractSpdxId handles TOML-style comment", () => { - const content = "# SPDX-License-Identifier: MPL-2.0\n[section]"; + let content = "# SPDX-License-Identifier: MPL-2.0\n[section]"; assertEquals(extractSpdxId(content), "MPL-2.0"); }); @@ -67,7 +64,7 @@ Deno.test("unit: extractSpdxId returns null when header absent", () => { }); Deno.test("unit: extractSpdxId handles leading whitespace", () => { - const content = " // SPDX-License-Identifier: MPL-2.0\n"; + let content = " // SPDX-License-Identifier: MPL-2.0\n"; assertEquals(extractSpdxId(content), "MIT"); }); @@ -76,7 +73,7 @@ Deno.test("unit: extractSpdxId handles leading whitespace", () => { // --------------------------------------------------------------------------- /** Returns true if the string contains an unresolved Mustache-style placeholder. */ -function containsUnresolvedPlaceholder(content: string): boolean { +fn containsUnresolvedPlaceholder(content: string): boolean { // Match {{WORD}} patterns but NOT Deno/JS template literals (${...}) return /\{\{[A-Z_]+\}\}/.test(content); } @@ -99,19 +96,19 @@ Deno.test("unit: containsUnresolvedPlaceholder allows clean content", () => { // --------------------------------------------------------------------------- Deno.test("unit: STATE.a2ml exists and has valid project name", async () => { - const content = await readFile(".machine_readable/6a2/STATE.a2ml"); + let content = await readFile(".machine_readable/6a2/STATE.a2ml"); assertNotEquals(content, null, "STATE.a2ml must exist"); assertMatch(content!, /project\s*=\s*"thunderbird-template-reloaded"/); }); Deno.test("unit: STATE.a2ml has SPDX header", async () => { - const content = await readFile(".machine_readable/6a2/STATE.a2ml"); + let content = await readFile(".machine_readable/6a2/STATE.a2ml"); assertNotEquals(content, null); assertEquals(extractSpdxId(content!), "MPL-2.0"); }); Deno.test("unit: STATE.a2ml has version field", async () => { - const content = await readFile(".machine_readable/6a2/STATE.a2ml"); + let content = await readFile(".machine_readable/6a2/STATE.a2ml"); assertNotEquals(content, null); assertMatch(content!, /version\s*=/); }); @@ -121,13 +118,13 @@ Deno.test("unit: STATE.a2ml has version field", async () => { // --------------------------------------------------------------------------- Deno.test("unit: LICENSE file exists and is non-empty", async () => { - const content = await readFile("LICENSE"); + let content = await readFile("LICENSE"); assertNotEquals(content, null, "LICENSE must exist"); assertNotEquals(content!.trim(), "", "LICENSE must not be empty"); }); Deno.test("unit: LICENSES directory contains PMPL text", async () => { - const exists = await pathExists("LICENSES/MPL-2.0.txt"); + let exists = await pathExists("LICENSES/MPL-2.0.txt"); assertEquals(exists, true, "LICENSES/MPL-2.0.txt must exist"); }); @@ -136,14 +133,13 @@ Deno.test("unit: LICENSES directory contains PMPL text", async () => { // --------------------------------------------------------------------------- Deno.test("unit: 0-AI-MANIFEST.a2ml exists", async () => { - const exists = await pathExists("0-AI-MANIFEST.a2ml"); + let exists = await pathExists("0-AI-MANIFEST.a2ml"); assertEquals(exists, true, "0-AI-MANIFEST.a2ml must exist"); }); Deno.test("unit: 0-AI-MANIFEST.a2ml is non-empty", async () => { - const content = await readFile("0-AI-MANIFEST.a2ml"); + let content = await readFile("0-AI-MANIFEST.a2ml"); assertNotEquals(content, null); assertNotEquals(content!.trim(), ""); }); -==================================== */