@@ -210,66 +210,4 @@ describe("OpenAPIGenerator", () => {
210210 getFuncStub . reset ( ) ;
211211 } ) ;
212212 } ) ;
213-
214- describe ( "createPostman" , ( ) => {
215- it ( "should generate a postman collection when a valid OpenAPI file is generated" , function ( ) {
216- const fsStub = sinon . stub ( fs , "writeFileSync" ) . returns ( true ) ;
217- const succSpy = sinon . spy ( logOutput . log , "success" ) ;
218- const errSpy = sinon . spy ( logOutput . log , "error" ) ;
219- const openAPIGenerator = new OpenAPIGenerator ( sls , { } , logOutput ) ;
220- openAPIGenerator . processCliInput ( ) ;
221-
222- openAPIGenerator . createPostman ( validOpenAPI ) ;
223-
224- expect ( fsStub . called ) . to . be . true ;
225- expect ( succSpy . calledTwice ) . to . be . true ;
226- expect ( errSpy . called ) . to . be . false ;
227- fsStub . restore ( ) ;
228- succSpy . restore ( ) ;
229- errSpy . restore ( ) ;
230- } ) ;
231-
232- it ( "should throw an error when writing a file fails" , function ( ) {
233- const errStub = sinon . stub ( logOutput . log , "error" ) . returns ( "" ) ;
234- const succSpy = sinon . spy ( logOutput . log , "success" ) ;
235- const fsStub = sinon
236- . stub ( fs , "writeFileSync" )
237- . throws ( new Error ( "throwing an error from writeFileSync" ) ) ;
238- const openAPIGenerator = new OpenAPIGenerator ( sls , { } , logOutput ) ;
239- openAPIGenerator . processCliInput ( ) ;
240-
241- expect ( ( ) => {
242- openAPIGenerator . createPostman ( validOpenAPI ) ;
243- } ) . to . throw ( ) ;
244-
245- expect ( fsStub . called ) . to . be . true ;
246- expect ( errStub . called ) . to . be . true ;
247- expect ( succSpy . calledOnce ) . to . be . true ;
248- expect ( succSpy . calledTwice ) . to . be . false ;
249- fsStub . restore ( ) ;
250- succSpy . restore ( ) ;
251- errStub . restore ( ) ;
252- } ) ;
253-
254- it ( "should throw an error converting an OpenAPI fails" , function ( ) {
255- const errStub = sinon . spy ( logOutput . log , "error" ) ;
256- const succSpy = sinon . spy ( logOutput . log , "success" ) ;
257- const pgStub = sinon . stub ( PostmanGenerator , "convert" ) ;
258- pgStub . yields ( new Error ( "throwing an error from PostmanGenerator" ) ) ;
259-
260- const openAPIGenerator = new OpenAPIGenerator ( sls , { } , logOutput ) ;
261- openAPIGenerator . processCliInput ( ) ;
262-
263- expect ( ( ) => {
264- openAPIGenerator . createPostman ( validOpenAPI ) ;
265- } ) . to . throw ( ) ;
266-
267- expect ( errStub . called ) . to . be . true ;
268- expect ( succSpy . calledOnce ) . to . be . false ;
269- expect ( succSpy . calledTwice ) . to . be . false ;
270-
271- succSpy . restore ( ) ;
272- errStub . restore ( ) ;
273- } ) ;
274- } ) ;
275213} ) ;
0 commit comments