mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-01 03:18:06 +03:00
test: delundefprop
This commit is contained in:
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user