11import fs from 'fs' ;
22import path from 'path' ;
33
4- import { describe , it , expect } from 'vitest' ;
4+ import { describe , it , expect , expectTypeOf } from 'vitest' ;
55
66import Extractor from '../src/extractor' ;
77
@@ -71,8 +71,8 @@ describe('Extractor', () => {
7171 expect ( endpoint . method ) . toBe ( 'get' ) ;
7272 expect ( endpoint . route ) . toBe ( '/pets' ) ;
7373 expect ( endpoint . description ) . toContain ( 'Returns all' ) ;
74- expect ( typeof endpoint . responses ) . toBe ( 'object' ) ;
75- expect ( typeof endpoint . responses [ '200' ] ) . toBe ( 'object' ) ;
74+ expectTypeOf ( endpoint . responses ) . toBeObject ( ) ;
75+ expectTypeOf ( endpoint . responses [ '200' ] ) . toBeObject ( ) ;
7676 } ) ;
7777
7878 it ( 'extracts markdown tables from endpoint comment strings' , ( ) => {
@@ -118,8 +118,8 @@ describe('Extractor', () => {
118118 expect ( endpoint . route ) . toBe ( '/pets' ) ;
119119 expect ( endpoint . summary ) . toBe ( 'Get pets' ) ;
120120 expect ( endpoint . description ) . toContain ( 'Returns all' ) ;
121- expect ( typeof endpoint . responses ) . toBe ( 'object' ) ;
122- expect ( typeof endpoint . responses [ '200' ] ) . toBe ( 'object' ) ;
121+ expectTypeOf ( endpoint . responses ) . toBeObject ( ) ;
122+ expectTypeOf ( endpoint . responses [ '200' ] ) . toBeObject ( ) ;
123123 } ) ;
124124
125125 it ( 'extracts endpoints from code strings' , ( ) => {
@@ -130,7 +130,7 @@ describe('Extractor', () => {
130130
131131 endpoints . forEach ( endpoint => {
132132 expect ( endpoint . route ) . toContain ( 'pet' ) ;
133- expect ( typeof endpoint . method ) . toBe ( 'string' ) ;
133+ expectTypeOf ( endpoint . method ) . toBeString ( ) ;
134134 expect ( Object . keys ( endpoint . responses ) ) . toHaveLength ( 2 ) ;
135135 } ) ;
136136 } ) ;
@@ -157,8 +157,8 @@ describe('Extractor', () => {
157157
158158 expect ( schema . name ) . toBe ( 'Pet' ) ;
159159 expect ( Array . isArray ( schema . required ) ) . toBe ( true ) ;
160- expect ( typeof schema . properties ) . toBe ( 'object' ) ;
161- expect ( typeof schema . properties . id ) . toBe ( 'object' ) ;
160+ expectTypeOf ( schema . properties ) . toBeObject ( ) ;
161+ expectTypeOf ( schema . properties . id ) . toBeObject ( ) ;
162162 } ) ;
163163
164164 it ( 'returns only endpoints' , ( ) => {
0 commit comments