Files
reacord/packages/reacord/helpers/prune-nullish-values.test.ts
2022-04-24 16:05:00 -05:00

34 lines
580 B
TypeScript

import { expect, test } from "vitest"
import { PruneNullishValues, pruneNullishValues } from "./prune-nullish-values"
test("pruneNullishValues", () => {
type InputType = {
a: string
b: string | null | undefined
c?: string
d: {
a: string
b: string | undefined
}
}
const input: InputType = {
a: "a",
b: null,
c: undefined,
d: {
a: "a",
b: undefined,
},
}
const output: PruneNullishValues<InputType> = {
a: "a",
d: {
a: "a",
},
}
expect(pruneNullishValues(input)).toEqual(output)
})