@@ -65,8 +65,8 @@ describe.concurrent("plugins", () => {
6565 export type User = components["schemas"]["User"];
6666 export type User_1 = components["schemas"]["User_1"];
6767 export type User_Name = components["schemas"]["User_Name"];
68- export type username = components["schemas"]["user-name"];
69- export type myorgUser = components["schemas"]["my.org.User"];
68+ export type UserName = components["schemas"]["user-name"];
69+ export type MyOrgUser = components["schemas"]["my.org.User"];
7070 export type Endpoints = keyof paths;
7171 "
7272 ` ) ;
@@ -149,4 +149,31 @@ describe.concurrent("plugins", () => {
149149
150150 expect ( emittedFile ) . toBeUndefined ( ) ;
151151 } ) ;
152+
153+ test ( "typesPlugin with enums" , async ( { expect } ) => {
154+ const plugin = typesPlugin ( ) ;
155+ assert ( plugin . transform ) ;
156+
157+ const result = await plugin . transform ( {
158+ config : await resolveConfig ( { input : "openapi.json" } ) ,
159+ id : openapiTypeScriptId ,
160+ code : `export interface components {
161+ schemas: {
162+ Status: string;
163+ Task: { name: string };
164+ }
165+ }
166+ export enum Status {
167+ Active = "active",
168+ Inactive = "inactive"
169+ }` ,
170+ filename : openapiTypeScriptFilename ,
171+ emitFile : ( ) => void 0
172+ } ) ;
173+
174+ assert ( result ) ;
175+
176+ expect ( result . code ) . toContain ( 'export type Task = components["schemas"]["Task"]' ) ;
177+ expect ( result . code ) . not . toContain ( 'export type Status = components["schemas"]["Status"]' ) ;
178+ } ) ;
152179} ) ;
0 commit comments