diff --git a/src/app/(home)/_components/about-contact.tsx b/src/app/(home)/_components/about-contact.tsx index cfbbf7d..a7f709a 100644 --- a/src/app/(home)/_components/about-contact.tsx +++ b/src/app/(home)/_components/about-contact.tsx @@ -20,10 +20,10 @@ export function AboutContact() { . Written in Rust and released under the MIT and Apache-2.0 licenses.
knet1. The
+ default name is friends. Nothing is listening yet.
+ >
+ ),
},
{
title: "Join",
@@ -19,7 +28,7 @@ const FLOW = [
detail:
"A runs share while B runs kimetsu network request. If discovery misses A, pass the peer: line share printed.",
},
-] as const;
+];
export function NetworkSection() {
return (
@@ -45,7 +54,7 @@ export function NetworkSection() {
knet1. The default name is friends. Nothing is listening yet.",
+ );
+ assert.equal(
+ section.includes("On B, membership is saved. Nothing is listening."),
+ true,
+ );
+ assert.equal(
+ section.includes(
+ "A runs share while B runs kimetsu network request. If discovery misses A, pass the peer: line share printed.",
+ ),
+ true,
+ );
+ for (const command of [
+ 'command: "kimetsu network invite --name laptop"',
+ 'command: "kimetsu network join "',
+ 'command: "kimetsu network share"',
+ ]) {
+ assert.equal(section.includes(command), true, command);
+ }
+});
+
test("does not repeat install commands in the network section", () => {
for (const command of [
"kimetsu plugin install grok-bot",
diff --git a/tests/text-link-target.test.mjs b/tests/text-link-target.test.mjs
new file mode 100644
index 0000000..5c7977a
--- /dev/null
+++ b/tests/text-link-target.test.mjs
@@ -0,0 +1,85 @@
+import assert from "node:assert/strict";
+import { readFile } from "node:fs/promises";
+import test from "node:test";
+
+const css = await readFile(
+ new URL("../src/app/global.css", import.meta.url),
+ "utf8",
+);
+
+const sources = {
+ benchmarks: await readFile(
+ new URL(
+ "../src/app/(home)/_components/benchmark-results.tsx",
+ import.meta.url,
+ ),
+ "utf8",
+ ),
+ network: await readFile(
+ new URL(
+ "../src/app/(home)/_components/network-section.tsx",
+ import.meta.url,
+ ),
+ "utf8",
+ ),
+ quickStart: await readFile(
+ new URL("../src/app/(home)/_components/quick-start.tsx", import.meta.url),
+ "utf8",
+ ),
+ page: await readFile(
+ new URL("../src/app/(home)/page.tsx", import.meta.url),
+ "utf8",
+ ),
+ about: await readFile(
+ new URL("../src/app/(home)/_components/about-contact.tsx", import.meta.url),
+ "utf8",
+ ),
+};
+
+const repeatedTarget = "inline-flex min-h-[24px] items-center";
+
+test("defines one tap-target utility beside km-text-link", () => {
+ const linkStart = css.indexOf(".km-text-link {");
+ const linkRule = css.slice(linkStart, css.indexOf("}", linkStart) + 1);
+ assert.equal(linkRule.includes("inline-flex"), false);
+ assert.equal(linkRule.includes("min-height"), false);
+ assert.match(
+ css,
+ /\.km-text-link-target\s*\{[^}]*display:\s*inline-flex;[^}]*min-height:\s*24px;[^}]*align-items:\s*center;[^}]*\}/s,
+ );
+});
+
+test("replaces the repeated min-height class string with the utility", () => {
+ for (const [name, source] of Object.entries(sources)) {
+ assert.equal(source.includes(repeatedTarget), false, name);
+ }
+ assert.equal(sources.benchmarks.match(/km-text-link-target/g)?.length, 1);
+ assert.equal(sources.network.match(/km-text-link-target/g)?.length, 1);
+ assert.equal(sources.quickStart.match(/km-text-link-target/g)?.length, 1);
+ assert.equal(sources.page.match(/km-text-link-target/g)?.length, 5);
+ assert.match(
+ sources.quickStart,
+ /className="km-text-link km-text-link-target mt-4"/,
+ );
+ assert.match(
+ sources.benchmarks,
+ /href="\/docs\/network\/results" className="km-text-link"/,
+ );
+ assert.equal(sources.benchmarks.includes("km-text-link mt-auto pt-6"), true);
+});
+
+test("gives the about and contact links the same 24px target", () => {
+ assert.match(
+ sources.about,
+ /href=\{links\.github\}[^>]*className="km-text-link km-text-link-target"[^>]*>\s*Source code →/,
+ );
+ assert.match(
+ sources.about,
+ /href="\/projects"[^>]*className="km-text-link km-text-link-target"[^>]*>\s*Related projects →/,
+ );
+ assert.match(
+ sources.about,
+ /href=\{links\.linkedin\}[\s\S]*?className="km-text-link km-text-link-target"[\s\S]*?LinkedIn/,
+ );
+ assert.equal(sources.about.match(/km-text-link-target/g)?.length, 3);
+});