Skip to content

Commit 41b3a77

Browse files
committed
Fix tests flagged in PR review comments
1 parent 00cf29b commit 41b3a77

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

server/test/src/prompts/workflow-prompts.test.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -701,19 +701,15 @@ describe('Workflow Prompts', () => {
701701
expect(result.success).toBe(false);
702702
});
703703

704-
it('should coerce non-numeric string for numStages to NaN (fails validation)', () => {
705-
// z.coerce.number() on a non-numeric string produces NaN
704+
it('should reject non-numeric string for numStages (NaN coercion)', () => {
705+
// z.coerce.number() on a non-numeric string produces NaN, which Zod
706+
// rejects because NaN is not a valid finite number.
706707
const result = workshopCreationWorkflowSchema.safeParse({
707708
queryPath: '/q.ql',
708709
language: 'java',
709710
numStages: 'abc',
710711
});
711-
// NaN coercion: z.coerce.number() turns 'abc' into NaN, which is still
712-
// type number, so Zod may accept it. Verify the actual behavior:
713-
if (result.success) {
714-
expect(result.data.numStages).toBeNaN();
715-
}
716-
// Either way, the test documents the behavior for slash command edge cases.
712+
expect(result.success).toBe(false);
717713
});
718714
});
719715

@@ -727,7 +723,7 @@ describe('Workflow Prompts', () => {
727723
*/
728724
const schemaSpecs: Array<{
729725
name: string;
730-
726+
731727
schema: any;
732728
required: string[];
733729
optional: string[];
@@ -798,7 +794,7 @@ describe('Workflow Prompts', () => {
798794

799795
it.each(schemaSpecs)(
800796
'$name — required fields must cause rejection when omitted individually',
801-
({ schema, required, optional }) => {
797+
({ schema, required, optional: _optional }) => {
802798
// Build a fully-valid object first
803799
const validObj: Record<string, string | number> = {};
804800
for (const key of required) {
@@ -811,7 +807,7 @@ describe('Workflow Prompts', () => {
811807
}
812808
}
813809
// Leave optional keys out — valid object with only required keys
814-
void optional;
810+
void _optional;
815811

816812
// Verify the base valid object passes
817813
const baseResult = schema.safeParse(validObj);
@@ -873,7 +869,7 @@ describe('Workflow Prompts', () => {
873869
'%s — every field should have a non-empty description',
874870
(_name, schema) => {
875871
for (const [key, zodType] of Object.entries(schema.shape)) {
876-
872+
877873
const desc = (zodType as any).description ?? (zodType as any)._def?.description;
878874
expect(
879875
desc,

0 commit comments

Comments
 (0)