From 939e8f0d1e7edd8dca5c2d8d09d500151768807d Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Thu, 3 Jul 2025 16:25:30 -0700 Subject: [PATCH] Fix test assert definitions. --- test/GLOBALS.mjs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/GLOBALS.mjs b/test/GLOBALS.mjs index b02debc..14ab050 100644 --- a/test/GLOBALS.mjs +++ b/test/GLOBALS.mjs @@ -180,8 +180,7 @@ export const assert = { }, exists: (a) => { if (a == null) { - const type = /^[aeiou]/i.test(typeof a) ? `an ${typeof a}` : `a ${typeof a}` - throw new Error(`argument exists and is ${type}`) + throw new Error(`argument is ${typeof a}`) } return a != null }, @@ -203,6 +202,13 @@ export const assert = { } return a !== b }, + nullish: (a) => { + if (a != null) { + const type = /^[aeiou]/i.test(typeof a) ? `an ${typeof a}` : `a ${typeof a}` + throw new Error(`argument exists and is ${type}`) + } + return a == null + }, rejects: async (fn, msg) => { if (fn.constructor.name === 'AsyncFunction') { fn = fn() -- 2.47.3