removed usages of EntityContext in tests and stories

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-09-11 14:26:06 +02:00
parent e95b379d5f
commit 18826333a7
13 changed files with 97 additions and 157 deletions
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { Entity } from '@backstage/catalog-model';
import { EntityContext } from '@backstage/plugin-catalog-react';
import { EntityProvider } from '@backstage/plugin-catalog-react';
import { renderHook } from '@testing-library/react-hooks';
import React, { PropsWithChildren } from 'react';
import { useConsumerGroupsForEntity } from './useConsumerGroupsForEntity';
@@ -23,11 +23,7 @@ describe('useConsumerGroupOffsets', () => {
let entity: Entity;
const wrapper = ({ children }: PropsWithChildren<{}>) => {
return (
<EntityContext.Provider value={{ entity: entity, loading: false }}>
{children}
</EntityContext.Provider>
);
return <EntityProvider entity={entity}>{children}</EntityProvider>;
};
const subject = () => renderHook(useConsumerGroupsForEntity, { wrapper });
@@ -14,7 +14,7 @@
* limitations under the License.
*/
import { Entity } from '@backstage/catalog-model';
import { EntityContext } from '@backstage/plugin-catalog-react';
import { EntityProvider } from '@backstage/plugin-catalog-react';
import { renderHook } from '@testing-library/react-hooks';
import { when } from 'jest-when';
import React, { PropsWithChildren } from 'react';
@@ -65,9 +65,7 @@ describe('useConsumerGroupOffsets', () => {
mockKafkaApi,
)}
>
<EntityContext.Provider value={{ entity: entity, loading: false }}>
{children}
</EntityContext.Provider>
<EntityProvider entity={entity}>{children}</EntityProvider>
</ApiProvider>
);
};