@@ -7,6 +7,7 @@ import '../helpers/miqFlashLater';
77import '../helpers/miqSparkle' ;
88import '../helpers/miqAjaxButton' ;
99import '../helpers/sprintf' ;
10+ import '../helpers/codemirrorRangeMock' ;
1011import { mount } from '../helpers/mountForm' ;
1112
1213import OrcherstrationTemplateForm from '../../components/orchestration-template/orcherstration-template-form' ;
@@ -33,7 +34,7 @@ describe('OrcherstrationTemplate form', () => {
3334 addFlashSpy . mockRestore ( ) ;
3435 } ) ;
3536
36- it ( 'should call submit function' , async ( done ) => {
37+ it ( 'should call submit function' , async ( ) => {
3738 fetchMock . postOnce ( '/api/orchestration_templates' , { } ) ;
3839 let wrapper ;
3940 await act ( async ( ) => {
@@ -58,10 +59,9 @@ describe('OrcherstrationTemplate form', () => {
5859 content : 'Some random content' ,
5960 } ) ) ;
6061 expect ( sparkleOnSpy ) . toHaveBeenCalledTimes ( 1 ) ;
61- done ( ) ;
6262 } ) ;
6363
64- it ( 'should call miqFlashLater on cancel action' , async ( done ) => {
64+ it ( 'should call miqFlashLater on cancel action' , async ( ) => {
6565 let wrapper ;
6666 await act ( async ( ) => {
6767 wrapper = mount ( < OrcherstrationTemplateForm { ...initialProps } /> ) ;
@@ -77,10 +77,9 @@ describe('OrcherstrationTemplate form', () => {
7777 'success' ,
7878 '/catalog/explorer' ,
7979 ) ;
80- done ( ) ;
8180 } ) ;
8281
83- it ( 'should render edit variant' , async ( done ) => {
82+ it ( 'should render edit variant' , async ( ) => {
8483 const sparkleOnSpy = jest . spyOn ( window , 'miqSparkleOn' ) ;
8584 fetchMock . patchOnce ( '/api/orchestration_templates/123' , { } ) ;
8685 fetchMock . getOnce ( '/api/orchestration_templates/123?attributes=name,description,type,ems_id,draft,content' , {
@@ -104,10 +103,9 @@ describe('OrcherstrationTemplate form', () => {
104103 content : 'content' ,
105104 } ) ) ;
106105 expect ( sparkleOnSpy ) . toHaveBeenCalledTimes ( 1 ) ;
107- done ( ) ;
108106 } ) ;
109107
110- it ( 'should render copy variant' , async ( done ) => {
108+ it ( 'should render copy variant' , async ( ) => {
111109 const sparkleOnSpy = jest . spyOn ( window , 'miqSparkleOn' ) ;
112110 fetchMock . postOnce ( '/api/orchestration_templates/123' , { } ) ;
113111 fetchMock . getOnce ( '/api/orchestration_templates/123?attributes=name,description,type,ems_id,draft,content' , {
@@ -141,7 +139,6 @@ describe('OrcherstrationTemplate form', () => {
141139 } ,
142140 } ) ) ;
143141 expect ( sparkleOnSpy ) . toHaveBeenCalledTimes ( 1 ) ;
144- done ( ) ;
145142 } ) ;
146143} ) ;
147144
@@ -167,7 +164,7 @@ describe('Orcherstration Stack form', () => {
167164 spyMiqAjaxButton . mockRestore ( ) ;
168165 } ) ;
169166
170- it ( 'should render copy variant' , async ( done ) => {
167+ it ( 'should render copy variant' , async ( ) => {
171168 const sparkleOnSpy = jest . spyOn ( window , 'miqSparkleOn' ) ;
172169 fetchMock . postOnce ( '/api/orchestration_templates/123' , { } ) ;
173170 fetchMock . getOnce ( '/api/orchestration_templates/123?attributes=name,description,type,ems_id,draft,content' , {
@@ -195,10 +192,9 @@ describe('Orcherstration Stack form', () => {
195192 expect ( fetchMock . lastCall ( ) ) . toBeTruthy ( ) ;
196193 expect ( sparkleOnSpy ) . toHaveBeenCalledTimes ( 1 ) ;
197194 expect ( wrapper ) . toMatchSnapshot ( ) ;
198- done ( ) ;
199195 } ) ;
200196
201- it ( 'should call submit function' , async ( done ) => {
197+ it ( 'should call submit function' , ( ) => {
202198 const addContent = {
203199 templateId : 123 ,
204200 templateName : 'template_name' ,
@@ -209,16 +205,14 @@ describe('Orcherstration Stack form', () => {
209205
210206 miqAjaxButton ( `/orchestration_stack/stacks_ot_copy?button=add` , addContent ) ;
211207 expect ( spyMiqAjaxButton ) . toHaveBeenCalledWith ( '/orchestration_stack/stacks_ot_copy?button=add' , addContent ) ;
212- done ( ) ;
213208 } ) ;
214209
215- it ( 'should call cancel function' , async ( done ) => {
210+ it ( 'should call cancel function' , ( ) => {
216211 const cancelMessage = __ ( 'Copy of Orchestration Template was cancelled by the user' ) ;
217212 miqRedirectBack ( cancelMessage , 'success' , `/orchestration_stack/show/${ 123 } ?display=stack_orchestration_template#/` ) ;
218213
219214 expect ( miqRedirectBack ) . toHaveBeenCalledWith (
220215 cancelMessage , 'success' , `/orchestration_stack/show/${ 123 } ?display=stack_orchestration_template#/`
221216 ) ;
222- done ( ) ;
223217 } ) ;
224218} ) ;
0 commit comments