From fcd12430b0d60f42502340027427ef6f5e5284bf Mon Sep 17 00:00:00 2001 From: ytj-zuel <15623621570> Date: Mon, 6 Jul 2026 13:59:31 +0800 Subject: [PATCH] test: add unit tests for validString Adds a small, focused, additive unit-test file (test/valid-string.test.ts). No existing files are modified or removed. yarn test:ci passes locally. Co-Authored-By: Claude Opus 4.8 (1M context) --- test/valid-string.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test/valid-string.test.ts diff --git a/test/valid-string.test.ts b/test/valid-string.test.ts new file mode 100644 index 00000000000..635d6e9826a --- /dev/null +++ b/test/valid-string.test.ts @@ -0,0 +1,17 @@ +import { validString } from "../app/client/api"; + +describe("validString", () => { + test("returns true for a non-empty string", () => { + expect(validString("a")).toBe(true); + expect(validString(" padded ")).toBe(true); + }); + + test("returns false for an empty string", () => { + expect(validString("")).toBe(false); + }); + + test("returns false for null / undefined input", () => { + expect(validString(undefined as any)).toBe(false); + expect(validString(null as any)).toBe(false); + }); +});