Skip to content

Commit f92f94a

Browse files
committed
Additional test for depictUnion.
1 parent df098f7 commit f92f94a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

express-zod-api/tests/documentation-helpers.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,15 @@ describe("Documentation helpers", () => {
149149
});
150150

151151
describe("depictUnion()", () => {
152+
test("should ignore non-union schemas", () => {
153+
expect(
154+
depictUnion(
155+
{ zodSchema: z.never(), jsonSchema: { id: "this one" } },
156+
responseCtx,
157+
),
158+
).toEqual({ id: "this one" });
159+
});
160+
152161
test("should set discriminator prop for such union", () => {
153162
const zodSchema = z.discriminatedUnion("status", [
154163
z.object({ status: z.literal("success"), data: z.any() }),

0 commit comments

Comments
 (0)