|
| 1 | +import { LinkSchema } from "@/lib/zod/schemas"; |
1 | 2 | import { Link, Tag } from "@prisma/client"; |
2 | 3 | import { describe, expect, test } from "vitest"; |
3 | 4 | import { randomId } from "../utils/helpers"; |
@@ -44,6 +45,7 @@ describe.sequential("POST /links", async () => { |
44 | 45 | qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`, |
45 | 46 | tags: [], |
46 | 47 | }); |
| 48 | + expect(LinkSchema.strict().parse(link)).toBeTruthy(); |
47 | 49 |
|
48 | 50 | await h.deleteLink(link.id); |
49 | 51 | }); |
@@ -73,6 +75,7 @@ describe.sequential("POST /links", async () => { |
73 | 75 | qrCode: `https://api.dub.co/qr?url=https://${domain}/${key}?qr=1`, |
74 | 76 | tags: [], |
75 | 77 | }); |
| 78 | + expect(LinkSchema.strict().parse(link)).toBeTruthy(); |
76 | 79 |
|
77 | 80 | await h.deleteLink(link.id); |
78 | 81 | }); |
@@ -105,6 +108,7 @@ describe.sequential("POST /links", async () => { |
105 | 108 | qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`, |
106 | 109 | tags: [], |
107 | 110 | }); |
| 111 | + expect(LinkSchema.strict().parse(link)).toBeTruthy(); |
108 | 112 |
|
109 | 113 | await h.deleteLink(link.id); |
110 | 114 | }); |
@@ -144,6 +148,7 @@ describe.sequential("POST /links", async () => { |
144 | 148 | qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`, |
145 | 149 | tags: [], |
146 | 150 | }); |
| 151 | + expect(LinkSchema.strict().parse(link)).toBeTruthy(); |
147 | 152 |
|
148 | 153 | await h.deleteLink(link.id); |
149 | 154 | }); |
@@ -173,6 +178,7 @@ describe.sequential("POST /links", async () => { |
173 | 178 | qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`, |
174 | 179 | tags: [], |
175 | 180 | }); |
| 181 | + expect(LinkSchema.strict().parse(link)).toBeTruthy(); |
176 | 182 |
|
177 | 183 | await h.deleteLink(link.id); |
178 | 184 | }); |
@@ -205,6 +211,7 @@ describe.sequential("POST /links", async () => { |
205 | 211 | qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`, |
206 | 212 | tags: [], |
207 | 213 | }); |
| 214 | + expect(LinkSchema.strict().parse(link)).toBeTruthy(); |
208 | 215 |
|
209 | 216 | await h.deleteLink(link.id); |
210 | 217 | }); |
@@ -238,6 +245,7 @@ describe.sequential("POST /links", async () => { |
238 | 245 | qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`, |
239 | 246 | tags: [], |
240 | 247 | }); |
| 248 | + expect(LinkSchema.strict().parse(link)).toBeTruthy(); |
241 | 249 |
|
242 | 250 | await h.deleteLink(link.id); |
243 | 251 | }); |
@@ -271,6 +279,7 @@ describe.sequential("POST /links", async () => { |
271 | 279 | qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`, |
272 | 280 | tags: [], |
273 | 281 | }); |
| 282 | + expect(LinkSchema.strict().parse(link)).toBeTruthy(); |
274 | 283 |
|
275 | 284 | await h.deleteLink(link.id); |
276 | 285 | }); |
@@ -323,6 +332,7 @@ describe.sequential("POST /links", async () => { |
323 | 332 | qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`, |
324 | 333 | tags: expect.arrayContaining(tags), |
325 | 334 | }); |
| 335 | + expect(LinkSchema.strict().parse(link)).toBeTruthy(); |
326 | 336 |
|
327 | 337 | await Promise.all([ |
328 | 338 | ...tagIds.map((id) => h.deleteTag(id)), |
@@ -358,6 +368,7 @@ describe.sequential("POST /links", async () => { |
358 | 368 | qrCode: `https://api.dub.co/qr?url=https://${domain}/${link.key}?qr=1`, |
359 | 369 | tags: [], |
360 | 370 | }); |
| 371 | + expect(LinkSchema.strict().parse(link)).toBeTruthy(); |
361 | 372 |
|
362 | 373 | await h.deleteLink(link.id); |
363 | 374 | }); |
|
0 commit comments