File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,6 +196,26 @@ describe('parseTpl', () => {
196196 const result = parseTpl ( dto ) ;
197197 expect ( result ) . toBe ( '{{{trainMonetaryAmount}}}' ) ;
198198 } ) ;
199+
200+ it ( 'keeps placeholder text when casing getter changes during replacement' , ( ) => {
201+ const options = { } ;
202+ let readCount = 0 ;
203+ Object . defineProperty ( options , 'casing' , {
204+ get ( ) {
205+ readCount += 1 ;
206+ return readCount === 1 ? 'camelCase' : '' ;
207+ }
208+ } ) ;
209+
210+ const dto = {
211+ template : '{{<tag>Id}}' ,
212+ oaOperation : oaOperation ,
213+ dynamicValues : { } ,
214+ options
215+ } ;
216+ const result = parseTpl ( dto ) ;
217+ expect ( result ) . toBe ( '{{TrainId}}' ) ;
218+ } ) ;
199219} ) ;
200220
201221describe ( 'hasTpl' , ( ) => {
@@ -223,3 +243,18 @@ describe('hasTpl', () => {
223243 expect ( result ) . toBe ( true ) ;
224244 } ) ;
225245} ) ;
246+
247+ describe ( 'getOperation' , ( ) => {
248+ it ( 'returns undefined when path exists but method does not' , ( ) => {
249+ const oa = {
250+ paths : {
251+ '/trains/{id}' : {
252+ get : { operationId : 'trainDetails' }
253+ }
254+ }
255+ } ;
256+
257+ const result = getOperation ( '/trains/{id}' , 'post' , oa ) ;
258+ expect ( result ) . toBeUndefined ( ) ;
259+ } ) ;
260+ } ) ;
You can’t perform that action at this time.
0 commit comments