simplify TeamsDropdown component and update ManageHostPage to keep po… (#7606)

* simplify TeamsDropdown component and update ManageHostPage to keep policy filter across team change

* fix TeamDropdown for users not on global team
This commit is contained in:
Gabriel Hernandez
2022-09-12 16:18:12 +01:00
committed by GitHub
parent 5614ab2501
commit eb06ef8049
8 changed files with 145 additions and 60 deletions
+23
View File
@@ -0,0 +1,23 @@
import React from "react";
import { render, RenderOptions } from "@testing-library/react";
import { AppContext, IAppContext, initialState } from "context/app";
type RenderOptionsWithProviderProps = RenderOptions & {
contextValue: Partial<IAppContext>;
};
/**
* A custom render method that provides a configurable App context when testing components
*/
// eslint-disable-next-line import/prefer-default-export
export const renderWithAppContext = (
component: React.ReactNode,
{ contextValue, ...renderOptions }: RenderOptionsWithProviderProps
) => {
const value: IAppContext = { ...initialState, ...contextValue };
return render(
<AppContext.Provider value={value}>{component}</AppContext.Provider>,
renderOptions
);
};