tridactyl/src/msgsafe.test.ts
2018-04-13 19:28:03 +01:00

25 lines
460 B
TypeScript

import * as msgsafe from "./msgsafe"
const allsafe = {
a: 1,
b: true,
c: "three",
// d: null,
e: undefined,
}
function helper(testname, obj, safeobj) {
test(testname, () => expect(msgsafe.generic(obj)).toMatchObject(safeobj))
}
helper("allsafe", allsafe, allsafe)
helper("remove function", { f: () => {}, b: 1 }, { b: 1 })
helper(
"remove all bad",
{
a: Symbol(),
b: () => {},
c: {},
},
{},
)