TOON
npub18nf33f6…/

hello-compare-rig

Public

feat: exclaim the greeting + test script cb9ceb6

Mergednpub18nf33f6… opened this patch · 1 comment
npub18nf33f6…opened
From ca7e3072196b658596ee042e7c52d764a978f6c2 Mon Sep 17 00:00:00 2001
From: Jonathan Green <dev.jonathan.green@gmail.com>
Date: Thu, 2 Jul 2026 17:26:29 -0400
Subject: [PATCH] feat: exclaim the greeting; add test script

---
 index.js     | 2 +-
 package.json | 3 ++-
 test.js      | 6 ++++++
 3 files changed, 9 insertions(+), 2 deletions(-)
 create mode 100644 test.js

diff --git a/index.js b/index.js
index 5628978..e34f942 100644
--- a/index.js
+++ b/index.js
@@ -1,2 +1,2 @@
 const name = process.argv[2] || "world";
-console.log(`Hello, ${name}!`);
+console.log(`Hello, ${name}!!`);
diff --git a/package.json b/package.json
index a335f55..6ccb1f4 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,8 @@
   "description": "Hello world project for the rig UX study",
   "main": "index.js",
   "scripts": {
-    "start": "node index.js"
+    "start": "node index.js",
+    "test": "node test.js"
   },
   "license": "MIT"
 }
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..41c4d0a
--- /dev/null
+++ b/test.js
@@ -0,0 +1,6 @@
+const { execFileSync } = require("node:child_process");
+const assert = require("node:assert");
+
+assert.strictEqual(execFileSync(process.execPath, ["index.js"]).toString().trim(), "Hello, world!!");
+assert.strictEqual(execFileSync(process.execPath, ["index.js", "Ada"]).toString().trim(), "Hello, Ada!!");
+console.log("ok");
-- 
2.43.0

npub18nf33f6…commented

Self-review: test covers default and named cases. Merging.

This change was applied and the thread closed.

← All patches and pull requests