From: Chris Duncan Date: Fri, 6 Dec 2024 06:01:53 +0000 (-0800) Subject: Fix assertions which would never fail due to how tests are called. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=7eec4e3e6fe2b277d64ac3038cf4837008820312;p=libnemo.git Fix assertions which would never fail due to how tests are called. --- diff --git a/GLOBALS.mjs b/GLOBALS.mjs index f5649ee..1b60059 100644 --- a/GLOBALS.mjs +++ b/GLOBALS.mjs @@ -66,9 +66,15 @@ export const assert = { return b != null }, equals: (a, b) => { + if (a !== b) { + throw new Error(`${a?.constructor?.name ?? typeof a} not equal to ${b?.constructor?.name ?? typeof b}`) + } return a === b }, notEqual: (a, b) => { + if (a === b) { + throw new Error(`${a?.constructor?.name ?? typeof a} equals ${b?.constructor?.name ?? typeof b}`) + } return a !== b }, rejects: async (fn, msg) => {