File tree 2 files changed +7
-7
lines changed
2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ import {
36
36
useDeletePolicy ,
37
37
useExportPoliciesByIds ,
38
38
useGetPolicy ,
39
- useLoadPolicyPromise ,
39
+ useLazyGetPolicy ,
40
40
useImportPolicy ,
41
41
} from '../policies' ;
42
42
@@ -155,12 +155,12 @@ describe('useClonePolicy tests', () => {
155
155
} ) ;
156
156
} ) ;
157
157
158
- const GetPromisedPolicyComponent = ( ) => {
159
- const loadPolicyPromise = useLoadPolicyPromise ( ) ;
158
+ const GetLazyPolicyComponent = ( ) => {
159
+ const [ getPolicy ] = useLazyGetPolicy ( ) ;
160
160
const [ policy , setPolicy ] = useState ( ) ;
161
161
162
162
const handleLoadPolicy = policyId => {
163
- return loadPolicyPromise ( policyId ) . then ( response => setPolicy ( response ) ) ;
163
+ return getPolicy ( policyId ) . then ( response => setPolicy ( response ) ) ;
164
164
} ;
165
165
166
166
return (
@@ -177,11 +177,11 @@ const GetPromisedPolicyComponent = () => {
177
177
) ;
178
178
} ;
179
179
180
- describe ( 'useLoadPolicyPromise tests' , ( ) => {
180
+ describe ( 'useLazyGetPolicy tests' , ( ) => {
181
181
test ( 'should query policy after user interaction' , async ( ) => {
182
182
const [ mock , resultFunc ] = createGetPolicyQueryMock ( ) ;
183
183
const { render} = rendererWith ( { queryMocks : [ mock ] } ) ;
184
- render ( < GetPromisedPolicyComponent /> ) ;
184
+ render ( < GetLazyPolicyComponent /> ) ;
185
185
186
186
await wait ( ) ;
187
187
Original file line number Diff line number Diff line change @@ -210,7 +210,7 @@ export const useLazyGetPolicy = () => {
210
210
fetchPolicy : 'no-cache' , // do not cache, since this is used when a change is saved
211
211
} )
212
212
. then ( response => {
213
- if ( isDefined ( response ?. data ?. policy ) {
213
+ if ( isDefined ( response ?. data ?. policy ) ) {
214
214
policy = Policy . fromObject ( response ?. data ?. policy ) ;
215
215
}
216
216
You can’t perform that action at this time.
0 commit comments