@@ -148,6 +148,111 @@ describe('MethodGenerator', () => {
148148 expect ( result . trim ( ) ) . toMatchSnapshot ( ) ;
149149 } ) ;
150150
151+ test ( 'renders with destructuring default values when customMethodConfig is partial' , ( ) => {
152+ const result = render (
153+ < MethodGenerator
154+ language = "java"
155+ methodName = "testMethod"
156+ methodParams = { [ 'String param1' , 'int param2' ] }
157+ customMethodConfig = { {
158+ returnType : 'public void' ,
159+ closingTag : '}' ,
160+ parameterWrap : false
161+ } }
162+ methodLogic = "System.out.println('Testing parameterWrap');"
163+ />
164+ ) ;
165+ expect ( result . trim ( ) ) . toMatchSnapshot ( ) ;
166+ } ) ;
167+
168+ test ( 'renders with framework config falls back to methodDocs prop when frameworkDocs missing' , ( ) => {
169+ const result = render (
170+ < MethodGenerator
171+ language = "java"
172+ methodName = "testMethod"
173+ methodDocs = "// Prop Docs"
174+ methodConfig = { {
175+ java : {
176+ quarkus : {
177+ methodLogic : 'System.out.println("Logic");'
178+ }
179+ }
180+ } }
181+ framework = "quarkus"
182+ />
183+ ) ;
184+
185+ expect ( result . trim ( ) ) . toMatchSnapshot ( ) ;
186+ } ) ;
187+
188+ test ( 'renders with framework config falls back to empty string when both docs missing' , ( ) => {
189+ const result = render (
190+ < MethodGenerator
191+ language = "java"
192+ methodName = "testMethod"
193+ methodConfig = { {
194+ java : {
195+ quarkus : { }
196+ }
197+ } }
198+ framework = "quarkus"
199+ />
200+ ) ;
201+
202+ expect ( result . trim ( ) ) . toMatchSnapshot ( ) ;
203+ } ) ;
204+
205+ test ( 'renders with language-level config falls back to methodLogic prop when config.methodLogic missing' , ( ) => {
206+ const result = render (
207+ < MethodGenerator
208+ language = "python"
209+ methodName = "testMethod"
210+ methodLogic = "print('from prop')"
211+ methodConfig = { {
212+ python : {
213+ methodDocs : 'Some docs'
214+ }
215+ } }
216+ />
217+ ) ;
218+
219+ expect ( result . trim ( ) ) . toMatchSnapshot ( ) ;
220+ } ) ;
221+
222+ test ( 'renders with language-level config falls back to empty string when both methodLogic sources missing' , ( ) => {
223+ const result = render (
224+ < MethodGenerator
225+ language = "python"
226+ methodName = "testMethod"
227+ methodConfig = { {
228+ python : {
229+ methodDocs : 'Some docs'
230+ }
231+ } }
232+ />
233+ ) ;
234+
235+ expect ( result . trim ( ) ) . toMatchSnapshot ( ) ;
236+ } ) ;
237+
238+ test ( 'renders with language-level config falls back to methodLogic prop' , ( ) => {
239+ const result = render (
240+ < MethodGenerator
241+ language = "python"
242+ methodName = "testMethod"
243+ methodLogic = "print('fallback')"
244+ methodConfig = { {
245+ python : {
246+ methodDocs : undefined ,
247+ methodLogic : undefined
248+ }
249+ } }
250+ />
251+ ) ;
252+
253+ expect ( result . trim ( ) ) . toMatchSnapshot ( ) ;
254+ } ) ;
255+
151256 test ( 'throws an error when unsupported language is provided' , ( ) => {
152257 expect ( ( ) =>
153258 render (
0 commit comments