@@ -139,3 +139,40 @@ test('default issue-826 wraps bodies whose readonly props come from nested schem
139139 'nestedReadonlyObject?: NonReadonly<NestedReadonlyObject>' ,
140140 ) ;
141141} ) ;
142+
143+ test ( 'default issue-873 does not duplicate multi-tag operations across tag files' , async ( ) => {
144+ // Regression for #873: an operation declaring multiple tags
145+ // (`listPets` has `tags: [cats, dogs]` in multiple-tags.yaml) must be
146+ // emitted only under its first tag. Emitting it under every tag duplicated
147+ // the operation across tag files and made the workspace index re-export the
148+ // same symbol twice, so the generated code failed to compile. Keep this
149+ // focused assertion alongside the snapshot so #873 fails with a targeted
150+ // message instead of a full-file snapshot diff.
151+ const marker = 'export const listPets = (' ;
152+
153+ // [mode, first-tag file, later-tag file]
154+ const modes = [
155+ [ 'multiple-tags' , [ 'cats.ts' ] , [ 'dogs.ts' ] ] ,
156+ [ 'multiple-tags-split' , [ 'cats' , 'cats.ts' ] , [ 'dogs' , 'dogs.ts' ] ] ,
157+ ] as const ;
158+
159+ for ( const [ mode , firstTag , laterTag ] of modes ) {
160+ const firstTagContent = await readFile (
161+ generated ( 'default' , mode , ...firstTag ) ,
162+ 'utf8' ,
163+ ) ;
164+ const laterTagContent = await readFile (
165+ generated ( 'default' , mode , ...laterTag ) ,
166+ 'utf8' ,
167+ ) ;
168+
169+ expect (
170+ firstTagContent ,
171+ `${ mode } : listPets should be emitted under its first tag` ,
172+ ) . toContain ( marker ) ;
173+ expect (
174+ laterTagContent ,
175+ `${ mode } : listPets must not be duplicated into a later tag` ,
176+ ) . not . toContain ( marker ) ;
177+ }
178+ } ) ;
0 commit comments