Skip to content

Commit a59ee10

Browse files
committed
Update tests
1 parent 2b137f9 commit a59ee10

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

gsa/src/web/graphql/__tests__/policies.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {
3636
useDeletePolicy,
3737
useExportPoliciesByIds,
3838
useGetPolicy,
39-
useLoadPolicyPromise,
39+
useLazyGetPolicy,
4040
useImportPolicy,
4141
} from '../policies';
4242

@@ -155,12 +155,12 @@ describe('useClonePolicy tests', () => {
155155
});
156156
});
157157

158-
const GetPromisedPolicyComponent = () => {
159-
const loadPolicyPromise = useLoadPolicyPromise();
158+
const GetLazyPolicyComponent = () => {
159+
const [getPolicy] = useLazyGetPolicy();
160160
const [policy, setPolicy] = useState();
161161

162162
const handleLoadPolicy = policyId => {
163-
return loadPolicyPromise(policyId).then(response => setPolicy(response));
163+
return getPolicy(policyId).then(response => setPolicy(response));
164164
};
165165

166166
return (
@@ -177,11 +177,11 @@ const GetPromisedPolicyComponent = () => {
177177
);
178178
};
179179

180-
describe('useLoadPolicyPromise tests', () => {
180+
describe('useLazyGetPolicy tests', () => {
181181
test('should query policy after user interaction', async () => {
182182
const [mock, resultFunc] = createGetPolicyQueryMock();
183183
const {render} = rendererWith({queryMocks: [mock]});
184-
render(<GetPromisedPolicyComponent />);
184+
render(<GetLazyPolicyComponent />);
185185

186186
await wait();
187187

gsa/src/web/graphql/policies.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export const useLazyGetPolicy = () => {
210210
fetchPolicy: 'no-cache', // do not cache, since this is used when a change is saved
211211
})
212212
.then(response => {
213-
if (isDefined(response?.data?.policy) {
213+
if (isDefined(response?.data?.policy)) {
214214
policy = Policy.fromObject(response?.data?.policy);
215215
}
216216

0 commit comments

Comments
 (0)