diff --git a/server/src/utils/misc.test.ts b/server/src/utils/misc.test.ts index 250c62630..05d5d2cf5 100644 --- a/server/src/utils/misc.test.ts +++ b/server/src/utils/misc.test.ts @@ -1,4 +1,9 @@ -import { GetMillisecondsSince, IsValidURL, RoundToNDecimalPlaces } from "./misc"; +import { + DeleteUndefinedProps, + GetMillisecondsSince, + IsValidURL, + RoundToNDecimalPlaces, +} from "./misc"; import t from "tap"; t.test("#GetMillisecondsSince", (t) => { @@ -9,6 +14,30 @@ t.test("#GetMillisecondsSince", (t) => { t.end(); }); +t.test("#DeleteUndefinedProps", (t) => { + const v = { + a: 1, + b: 2, + c: undefined, + d: { + e: 3, + f: undefined, + }, + }; + + DeleteUndefinedProps(v); + + t.strictSame(v, { + a: 1, + b: 2, + d: { + e: 3, + }, + }); + + t.end(); +}); + t.test("#IsValidURL", (t) => { t.ok(IsValidURL("https://example.com")); t.ok(IsValidURL("http://example.com"));