@@ -7,10 +7,10 @@ Deno.test("New usage with individual endpoints", () => {
77 . setVersion ( "1.0.0" ) ;
88
99 const endpoint1 = createEndpointBuilder ( )
10- . setMethod ( ' get' )
11- . setPath ( ' /tasks' )
12- . setSummary ( ' Get Tasks' )
13- . setOperationId ( ' getTasks' )
10+ . setMethod ( " get" )
11+ . setPath ( " /tasks" )
12+ . setSummary ( " Get Tasks" )
13+ . setOperationId ( " getTasks" )
1414 . setResponses ( {
1515 200 : {
1616 description : "Success response" ,
@@ -33,23 +33,23 @@ Deno.test("New usage with individual endpoints", () => {
3333 } ) ;
3434
3535 const endpoint2 = createEndpointBuilder ( )
36- . setMethod ( ' post' )
37- . setPath ( ' /tasks' )
38- . setSummary ( ' Create Task' )
39- . setOperationId ( ' createTask' )
36+ . setMethod ( " post" )
37+ . setPath ( " /tasks" )
38+ . setSummary ( " Create Task" )
39+ . setOperationId ( " createTask" )
4040 . setRequestBody (
4141 {
42- ' application/json' : {
42+ " application/json" : {
4343 schema : {
44- type : ' object' ,
44+ type : " object" ,
4545 properties : {
46- title : { type : ' string' } ,
47- completed : { type : ' boolean' } ,
46+ title : { type : " string" } ,
47+ completed : { type : " boolean" } ,
4848 } ,
4949 } ,
5050 } ,
5151 } ,
52- true
52+ true ,
5353 )
5454 . setResponses ( {
5555 201 : {
@@ -59,11 +59,11 @@ Deno.test("New usage with individual endpoints", () => {
5959
6060 // Add endpoint with different path
6161 const endpoint3 = createEndpointBuilder ( )
62- . setMethod ( ' get' )
63- . setPath ( ' /tasks/{taskId}' )
64- . setSummary ( ' Get Task by ID' )
65- . setOperationId ( ' getTaskById' )
66- . setParameter ( ' taskId' , ' path' , true , ' Task identifier' )
62+ . setMethod ( " get" )
63+ . setPath ( " /tasks/{taskId}" )
64+ . setSummary ( " Get Task by ID" )
65+ . setOperationId ( " getTaskById" )
66+ . setParameter ( " taskId" , " path" , true , " Task identifier" )
6767 . setResponses ( {
6868 200 : {
6969 description : "Task details" ,
@@ -79,34 +79,34 @@ Deno.test("New usage with individual endpoints", () => {
7979
8080 // Verify that we have two distinct paths
8181 assertEquals ( Object . keys ( result . paths || { } ) . length , 2 ) ;
82-
82+
8383 // Check that /tasks has both GET and POST methods
8484 // deno-lint-ignore no-explicit-any
85- const tasksPath = result . paths ?. [ ' /tasks' ] as any ;
86- assertEquals ( typeof tasksPath ?. get , ' object' ) ;
87- assertEquals ( typeof tasksPath ?. post , ' object' ) ;
88- assertEquals ( tasksPath ?. get ?. operationId , ' getTasks' ) ;
89- assertEquals ( tasksPath ?. post ?. operationId , ' createTask' ) ;
90-
85+ const tasksPath = result . paths ?. [ " /tasks" ] as any ;
86+ assertEquals ( typeof tasksPath ?. get , " object" ) ;
87+ assertEquals ( typeof tasksPath ?. post , " object" ) ;
88+ assertEquals ( tasksPath ?. get ?. operationId , " getTasks" ) ;
89+ assertEquals ( tasksPath ?. post ?. operationId , " createTask" ) ;
90+
9191 // Check that /tasks/{taskId} has GET method
9292 // deno-lint-ignore no-explicit-any
93- const taskByIdPath = result . paths ?. [ ' /tasks/{taskId}' ] as any ;
94- assertEquals ( typeof taskByIdPath ?. get , ' object' ) ;
95- assertEquals ( taskByIdPath ?. get ?. operationId , ' getTaskById' ) ;
93+ const taskByIdPath = result . paths ?. [ " /tasks/{taskId}" ] as any ;
94+ assertEquals ( typeof taskByIdPath ?. get , " object" ) ;
95+ assertEquals ( taskByIdPath ?. get ?. operationId , " getTaskById" ) ;
9696} ) ;
9797
9898Deno . test ( "Adding a single endpoint works" , ( ) => {
9999 const api = new OpenAPI ( ) ;
100-
100+
101101 api . addEndpoint (
102102 createEndpointBuilder ( )
103- . setMethod ( ' get' )
104- . setPath ( ' /users' )
105- . setOperationId ( ' getUsers' )
103+ . setMethod ( " get" )
104+ . setPath ( " /users" )
105+ . setOperationId ( " getUsers" ) ,
106106 ) ;
107-
107+
108108 // deno-lint-ignore no-explicit-any
109109 const result = api . getJSON ( ) as any ;
110- assertEquals ( typeof result . paths ?. [ ' /users' ] ?. get , ' object' ) ;
111- assertEquals ( result . paths ?. [ ' /users' ] ?. get ?. operationId , ' getUsers' ) ;
110+ assertEquals ( typeof result . paths ?. [ " /users" ] ?. get , " object" ) ;
111+ assertEquals ( result . paths ?. [ " /users" ] ?. get ?. operationId , " getUsers" ) ;
112112} ) ;
0 commit comments