Skip to content

Commit 3fe8dcf

Browse files
committed
A few more tests
1 parent d0731a4 commit 3fe8dcf

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/tests/legacy/strict.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ describe('Non-strict mode', () => {
151151
});
152152

153153
const form = await superValidate(input as Record<string, unknown>, zod(schema));
154-
expect(input).toMatchObject({ fooo: 'wrong-key', foo: 'correct-key' });
154+
155155
expect(form.data).toEqual({ foo: 'correct-key' });
156156
expect(form.errors).toEqual({});
157157
expect(form.valid).toEqual(true);

src/tests/superValidate.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ describe('Zod', () => {
321321
score: 1,
322322
stats: NaN
323323
});
324+
expect(form.errors).toEqual({ stats: ['Expected number, received nan'] });
324325

325326
formData.set('stats', '2');
326327

@@ -331,6 +332,15 @@ describe('Zod', () => {
331332
score: 1,
332333
stats: 2
333334
});
335+
336+
const name: string = form2.data.name;
337+
// @ts-expect-error Testing catchall type
338+
const notAString: string = form2.data.extra;
339+
const num: number = form2.data.stats;
340+
341+
name;
342+
notAString;
343+
num;
334344
});
335345

336346
schemaTest(zod(schema));

0 commit comments

Comments
 (0)