From a81e0ff4e85f33d7c609b106e6b65c2a18db1cf1 Mon Sep 17 00:00:00 2001 From: Derek Lewis Date: Thu, 8 Oct 2026 22:18:48 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=F0=9F=94=A7=EF=BC=9Apass=20the=20v?= =?UTF-8?q?alidateOneOf=20test=20in=20any=20locale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test spelled the expected message with curly quotes, but curlyQuote only uses them when LC_ALL, LC_CTYPE or LANG names UTF-8. Without one, as in a bare container, pnpm test failed on a message that was right. The expectation now uses curlyQuote too, as the util-errors tests already do. Signed-off-by: Derek Lewis Assisted-by: Claude-Code:claude-opus-5 --- packages/util/test/validators/validate-one-of.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/util/test/validators/validate-one-of.ts b/packages/util/test/validators/validate-one-of.ts index d7d9455..8fd1aaf 100644 --- a/packages/util/test/validators/validate-one-of.ts +++ b/packages/util/test/validators/validate-one-of.ts @@ -3,6 +3,8 @@ import assert from 'node:assert/strict'; import { describe, it } from 'node:test'; +import { curlyQuote } from '@openinf/util-text'; + import { validateOneOf } from '../../src/validators/validate-one-of'; describe(validateOneOf.name, () => { @@ -17,10 +19,12 @@ describe(validateOneOf.name, () => { ); assert.throws(() => validateOneOf('d', 'value', ['a', 'b', 'c']), { code: 'ERR_INVALID_ARG_VALUE', + // The quotes are curly only where the locale says the terminal can show + // them, so the expectation is built the same way the message is. message: - 'The argument \u201Cvalue\u201D must be one of: \u201Ca\u201D, ' + - '\u201Cb\u201D, \u201Cc\u201D. Received type \u201Cstring\u201D ' + - '(\u201Cd\u201D)', + `The argument ${curlyQuote('value')} must be one of: ` + + `${curlyQuote('a')}, ${curlyQuote('b')}, ${curlyQuote('c')}. ` + + `Received type ${curlyQuote('string')} (${curlyQuote('d')})`, }); });