@@ -22,8 +22,7 @@ import {
2222 mockOperatorCryostatList ,
2323 mockOperatorCryostatListWithoutTargetNamespaces ,
2424} from '@console-plugin/test/utils' ;
25- import { k8sPatchResource } from '@openshift/dynamic-plugin-sdk-utils' ;
26- import { K8sModel , useAccessReview , useK8sWatchResource } from '@openshift-console/dynamic-plugin-sdk' ;
25+ import { K8sModel , useAccessReview , useK8sWatchResource , k8sPatch } from '@openshift-console/dynamic-plugin-sdk' ;
2726import { render , screen , waitFor } from '@testing-library/react' ;
2827import userEvent from '@testing-library/user-event' ;
2928import '@testing-library/jest-dom' ;
@@ -37,11 +36,11 @@ jest.mock('@i18n/i18nextUtil', () => ({
3736jest . mock ( '@openshift-console/dynamic-plugin-sdk' , ( ) => ( {
3837 useAccessReview : jest . fn ( ) ,
3938 useK8sWatchResource : jest . fn ( ) ,
39+ k8sPatch : jest . fn ( ) ,
4040} ) ) ;
4141
42- jest . mock ( '@openshift/dynamic-plugin-sdk-utils' , ( ) => ( {
43- k8sPatchResource : jest . fn ( ) ,
44- isUtilsConfigSet : jest . fn ( ( ) => true ) ,
42+ jest . mock ( '@openshift-console/dynamic-plugin-sdk/lib/app/configSetup' , ( ) => ( {
43+ setUtilsConfig : jest . fn ( ) ,
4544} ) ) ;
4645
4746const mockDeploymentModel = {
@@ -117,7 +116,7 @@ describe('DeploymentLabelActionModal', () => {
117116 expect ( screen . getByText ( 'DEPLOYMENT_ACTION_HELM_CRYOSTAT_SELECTED' ) ) . toBeInTheDocument ( ) ;
118117 } ) ;
119118
120- it ( 'should call k8sPatchResource to add labels and env vars when completing wizard' , async ( ) => {
119+ it ( 'should call k8sPatch to add labels and env vars when completing wizard' , async ( ) => {
121120 renderModal ( mockDeploymentWithoutLabels ) ;
122121
123122 const select = screen . getByLabelText ( 'Cryostat Instance Selection' ) ;
@@ -138,9 +137,9 @@ describe('DeploymentLabelActionModal', () => {
138137 const finishButton = screen . queryByRole ( 'button' , { name : / f i n i s h | s u b m i t / i } ) ;
139138 if ( finishButton ) {
140139 await userEvent . click ( finishButton ) ;
141- expect ( k8sPatchResource ) . toHaveBeenCalled ( ) ;
140+ expect ( k8sPatch ) . toHaveBeenCalled ( ) ;
142141
143- const callArgs = ( k8sPatchResource as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
142+ const callArgs = ( k8sPatch as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
144143 expect ( callArgs . model ) . toEqual ( mockDeploymentModel ) ;
145144 expect ( callArgs . queryOptions ) . toEqual ( { name : 'test-app' , ns : 'test-namespace' } ) ;
146145
@@ -164,7 +163,7 @@ describe('DeploymentLabelActionModal', () => {
164163 }
165164 } ) ;
166165
167- it ( 'should call k8sPatchResource to remove labels when selecting the empty option' , async ( ) => {
166+ it ( 'should call k8sPatch to remove labels when selecting the empty option' , async ( ) => {
168167 renderModal ( mockDeploymentWithLabels ) ;
169168
170169 const selectElement = screen . getByLabelText ( 'Cryostat Instance Selection' ) ;
@@ -185,8 +184,8 @@ describe('DeploymentLabelActionModal', () => {
185184 const finishButton = screen . queryByRole ( 'button' , { name : / f i n i s h | s u b m i t / i } ) ;
186185 if ( finishButton ) {
187186 await userEvent . click ( finishButton ) ;
188- expect ( k8sPatchResource ) . toHaveBeenCalledTimes ( 1 ) ;
189- expect ( k8sPatchResource ) . toHaveBeenCalledWith ( {
187+ expect ( k8sPatch ) . toHaveBeenCalledTimes ( 1 ) ;
188+ expect ( k8sPatch ) . toHaveBeenCalledWith ( {
190189 model : mockDeploymentModel ,
191190 queryOptions : { name : 'test-app' , ns : 'test-namespace' } ,
192191 patches : [
@@ -259,10 +258,10 @@ describe('DeploymentLabelActionModal', () => {
259258 const finishButton = screen . queryByRole ( 'button' , { name : / f i n i s h | s u b m i t / i } ) ;
260259 if ( finishButton ) {
261260 await userEvent . click ( finishButton ) ;
262- expect ( k8sPatchResource ) . toHaveBeenCalled ( ) ;
261+ expect ( k8sPatch ) . toHaveBeenCalled ( ) ;
263262
264- const callArgs = ( k8sPatchResource as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
265- const patches = callArgs . patches ;
263+ const callArgs = ( k8sPatch as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
264+ const patches = callArgs . data ;
266265
267266 // Verify callback port patch is included
268267 expect ( patches ) . toEqual (
@@ -291,11 +290,11 @@ describe('DeploymentLabelActionModal', () => {
291290 await userEvent . click ( quickRegisterButton ) ;
292291
293292 await waitFor ( ( ) => {
294- expect ( k8sPatchResource ) . toHaveBeenCalled ( ) ;
293+ expect ( k8sPatch ) . toHaveBeenCalled ( ) ;
295294 } ) ;
296295
297- const callArgs = ( k8sPatchResource as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
298- const patches = callArgs . patches ;
296+ const callArgs = ( k8sPatch as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
297+ const patches = callArgs . data ;
299298
300299 // Verify callback port patch is NOT included
301300 const hasCallbackPortPatch = patches . some ( ( p ) => p . path ?. includes ( 'callback-port' ) ) ;
@@ -340,10 +339,10 @@ describe('DeploymentLabelActionModal', () => {
340339 const finishButton = screen . queryByRole ( 'button' , { name : / f i n i s h | s u b m i t / i } ) ;
341340 if ( finishButton ) {
342341 await userEvent . click ( finishButton ) ;
343- expect ( k8sPatchResource ) . toHaveBeenCalled ( ) ;
342+ expect ( k8sPatch ) . toHaveBeenCalled ( ) ;
344343
345- const callArgs = ( k8sPatchResource as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
346- const patches = callArgs . patches ;
344+ const callArgs = ( k8sPatch as jest . Mock ) . mock . calls [ 0 ] [ 0 ] ;
345+ const patches = callArgs . data ;
347346
348347 // Verify callback port removal patch is included
349348 expect ( patches ) . toEqual (
0 commit comments