@@ -138,6 +138,60 @@ describe('ProposalInputSchema (strict)', () => {
138138 expect ( result . success ) . toBe ( true )
139139 } )
140140
141+ it ( 'accepts workshop format with prerequisites' , ( ) => {
142+ const result = ProposalInputSchema . safeParse ( {
143+ ...fullProposal ,
144+ format : Format . workshop_120 ,
145+ capacity : 30 ,
146+ prerequisites : 'Bring a computer with Docker installed' ,
147+ } )
148+ expect ( result . success ) . toBe ( true )
149+ } )
150+
151+ it ( 'accepts non-workshop format without prerequisites' , ( ) => {
152+ const result = ProposalInputSchema . safeParse ( {
153+ ...fullProposal ,
154+ format : Format . presentation_40 ,
155+ prerequisites : undefined ,
156+ } )
157+ expect ( result . success ) . toBe ( true )
158+ } )
159+
160+ it ( 'rejects prerequisites for non-workshop formats' , ( ) => {
161+ const result = ProposalInputSchema . safeParse ( {
162+ ...fullProposal ,
163+ format : Format . presentation_40 ,
164+ prerequisites : 'Should not be allowed' ,
165+ } )
166+ expect ( result . success ) . toBe ( false )
167+ } )
168+
169+ it ( 'normalizes empty prerequisites to undefined' , ( ) => {
170+ const result = ProposalInputSchema . safeParse ( {
171+ ...fullProposal ,
172+ format : Format . workshop_120 ,
173+ capacity : 30 ,
174+ prerequisites : ' ' ,
175+ } )
176+ expect ( result . success ) . toBe ( true )
177+ if ( result . success ) {
178+ expect ( result . data . prerequisites ) . toBeUndefined ( )
179+ }
180+ } )
181+
182+ it ( 'trims whitespace from prerequisites' , ( ) => {
183+ const result = ProposalInputSchema . safeParse ( {
184+ ...fullProposal ,
185+ format : Format . workshop_120 ,
186+ capacity : 30 ,
187+ prerequisites : ' Docker required ' ,
188+ } )
189+ expect ( result . success ) . toBe ( true )
190+ if ( result . success ) {
191+ expect ( result . data . prerequisites ) . toBe ( 'Docker required' )
192+ }
193+ } )
194+
141195 it ( 'rejects missing title' , ( ) => {
142196 const { title : _ , ...withoutTitle } = fullProposal
143197 const result = ProposalInputSchema . safeParse ( withoutTitle )
0 commit comments