@@ -286,218 +286,6 @@ describe('createClient', () => {
286286 expect ( results ) . toHaveLength ( 4 ) ;
287287 } ) ;
288288
289- describe ( 'duplicate plugin warnings' , ( ) => {
290- const baseConfig = {
291- dryRun : true as const ,
292- input : {
293- info : { title : 'duplicate-plugin-test' , version : '1.0.0' } ,
294- openapi : '3.1.0' as const ,
295- } ,
296- logs : {
297- level : 'silent' as const ,
298- } ,
299- output : 'output' ,
300- } ;
301-
302- const conflictWarnings = ( warnSpy : ReturnType < typeof vi . spyOn > ) =>
303- warnSpy . mock . calls . filter (
304- ( args : unknown [ ] ) => typeof args [ 0 ] === 'string' && args [ 0 ] . includes ( 'conflicting options' ) ,
305- ) ;
306-
307- it ( 'warns when the same plugin is specified with conflicting options' , async ( ) => {
308- const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
309-
310- await createClient ( {
311- ...baseConfig ,
312- plugins : [
313- { case : 'PascalCase' , name : '@hey-api/typescript' } ,
314- { case : 'camelCase' , name : '@hey-api/typescript' } ,
315- ] ,
316- } ) ;
317-
318- expect ( conflictWarnings ( warnSpy ) ) . toHaveLength ( 1 ) ;
319- expect ( warnSpy ) . toHaveBeenCalledWith ( expect . stringContaining ( '"@hey-api/typescript"' ) ) ;
320-
321- warnSpy . mockRestore ( ) ;
322- } ) ;
323-
324- it ( 'does not warn when the same plugin is specified twice as a string' , async ( ) => {
325- const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
326-
327- await createClient ( {
328- ...baseConfig ,
329- plugins : [ '@hey-api/typescript' , '@hey-api/typescript' ] ,
330- } ) ;
331-
332- expect ( conflictWarnings ( warnSpy ) ) . toHaveLength ( 0 ) ;
333-
334- warnSpy . mockRestore ( ) ;
335- } ) ;
336-
337- it ( 'does not warn when a string and an object with only name are specified' , async ( ) => {
338- const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
339-
340- await createClient ( {
341- ...baseConfig ,
342- plugins : [ '@hey-api/typescript' , { name : '@hey-api/typescript' } ] ,
343- } ) ;
344-
345- expect ( conflictWarnings ( warnSpy ) ) . toHaveLength ( 0 ) ;
346-
347- warnSpy . mockRestore ( ) ;
348- } ) ;
349-
350- it ( 'does not warn when two identical object configurations are specified' , async ( ) => {
351- const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
352-
353- await createClient ( {
354- ...baseConfig ,
355- plugins : [
356- { case : 'PascalCase' , name : '@hey-api/typescript' } ,
357- { case : 'PascalCase' , name : '@hey-api/typescript' } ,
358- ] ,
359- } ) ;
360-
361- expect ( conflictWarnings ( warnSpy ) ) . toHaveLength ( 0 ) ;
362-
363- warnSpy . mockRestore ( ) ;
364- } ) ;
365-
366- it ( 'does not warn when objects differ only in key order' , async ( ) => {
367- const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
368-
369- await createClient ( {
370- ...baseConfig ,
371- plugins : [
372- { case : 'PascalCase' , name : '@hey-api/typescript' } ,
373- { name : '@hey-api/typescript' , case : 'PascalCase' } ,
374- ] ,
375- } ) ;
376-
377- expect ( conflictWarnings ( warnSpy ) ) . toHaveLength ( 0 ) ;
378-
379- warnSpy . mockRestore ( ) ;
380- } ) ;
381-
382- it ( 'does not warn when nested object configs differ only in key order' , async ( ) => {
383- const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
384-
385- await createClient ( {
386- ...baseConfig ,
387- plugins : [
388- {
389- definitions : { case : 'PascalCase' , name : 'foo' } ,
390- name : '@hey-api/typescript' ,
391- } ,
392- {
393- name : '@hey-api/typescript' ,
394- definitions : { name : 'foo' , case : 'PascalCase' } ,
395- } ,
396- ] ,
397- } ) ;
398-
399- expect ( conflictWarnings ( warnSpy ) ) . toHaveLength ( 0 ) ;
400-
401- warnSpy . mockRestore ( ) ;
402- } ) ;
403-
404- it ( 'warns when an object adds extra config compared to a string entry' , async ( ) => {
405- const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
406-
407- await createClient ( {
408- ...baseConfig ,
409- plugins : [ '@hey-api/typescript' , { case : 'PascalCase' , name : '@hey-api/typescript' } ] ,
410- } ) ;
411-
412- expect ( conflictWarnings ( warnSpy ) ) . toHaveLength ( 1 ) ;
413-
414- warnSpy . mockRestore ( ) ;
415- } ) ;
416-
417- it ( 'does not warn when array-valued options differ only in element key order' , async ( ) => {
418- const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
419-
420- await createClient ( {
421- ...baseConfig ,
422- plugins : [
423- {
424- items : [ { from : 'foo' , name : 'bar' } ] ,
425- name : '@hey-api/typescript' ,
426- } as never ,
427- {
428- items : [ { name : 'bar' , from : 'foo' } ] ,
429- name : '@hey-api/typescript' ,
430- } as never ,
431- ] ,
432- } ) ;
433-
434- expect ( conflictWarnings ( warnSpy ) ) . toHaveLength ( 0 ) ;
435-
436- warnSpy . mockRestore ( ) ;
437- } ) ;
438-
439- it ( 'warns when array-valued options differ in element order' , async ( ) => {
440- const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
441-
442- await createClient ( {
443- ...baseConfig ,
444- plugins : [
445- {
446- items : [ { from : 'a' , name : 'x' } , { from : 'b' , name : 'y' } ] ,
447- name : '@hey-api/typescript' ,
448- } as never ,
449- {
450- items : [ { from : 'b' , name : 'y' } , { from : 'a' , name : 'x' } ] ,
451- name : '@hey-api/typescript' ,
452- } as never ,
453- ] ,
454- } ) ;
455-
456- expect ( conflictWarnings ( warnSpy ) ) . toHaveLength ( 1 ) ;
457-
458- warnSpy . mockRestore ( ) ;
459- } ) ;
460-
461- it ( 'does not warn when function-valued options have identical source' , async ( ) => {
462- const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
463- const transform = ( s : string ) => s . toUpperCase ( ) ;
464-
465- await createClient ( {
466- ...baseConfig ,
467- plugins : [
468- { definitions : { name : transform } , name : '@hey-api/typescript' } ,
469- { definitions : { name : transform } , name : '@hey-api/typescript' } ,
470- ] ,
471- } ) ;
472-
473- expect ( conflictWarnings ( warnSpy ) ) . toHaveLength ( 0 ) ;
474-
475- warnSpy . mockRestore ( ) ;
476- } ) ;
477-
478- it ( 'warns when function-valued options differ' , async ( ) => {
479- const warnSpy = vi . spyOn ( console , 'warn' ) . mockImplementation ( ( ) => { } ) ;
480-
481- await createClient ( {
482- ...baseConfig ,
483- plugins : [
484- {
485- definitions : { name : ( s : string ) => s . toUpperCase ( ) } ,
486- name : '@hey-api/typescript' ,
487- } ,
488- {
489- definitions : { name : ( s : string ) => s . toLowerCase ( ) } ,
490- name : '@hey-api/typescript' ,
491- } ,
492- ] ,
493- } ) ;
494-
495- expect ( conflictWarnings ( warnSpy ) ) . toHaveLength ( 1 ) ;
496-
497- warnSpy . mockRestore ( ) ;
498- } ) ;
499- } ) ;
500-
501289 it ( 'executes @angular/common HttpRequest builder path' , async ( ) => {
502290 const results = await createClient ( {
503291 dryRun : true ,
0 commit comments