fix(editor): Hide version control main menu component if no feature flag (#6419)

* fix(editor): Hide version control main menu component if no feature flag

* fix(editor): Update unit tes

* test(editor): Test for feature flag
This commit is contained in:
Csaba Tuncsik
2023-06-13 17:09:17 +02:00
committed by GitHub
parent d041602754
commit 75c0ab03f8
2 changed files with 11 additions and 1 deletions

View File

@@ -28,7 +28,10 @@ const renderComponent = (renderOptions: Parameters<typeof render>[1] = {}) => {
};
describe('MainSidebarVersionControl', () => {
const getItemSpy = vi.spyOn(Storage.prototype, 'getItem');
beforeEach(() => {
getItemSpy.mockReturnValue('true');
pinia = createTestingPinia({
initialState: {
[STORES.SETTINGS]: {
@@ -41,6 +44,12 @@ describe('MainSidebarVersionControl', () => {
usersStore = useUsersStore();
});
it('should render nothing', async () => {
getItemSpy.mockReturnValue(null);
const { container } = renderComponent({ props: { isCollapsed: false } });
expect(container).toBeEmptyDOMElement();
});
it('should render empty content', async () => {
const { getByTestId } = renderComponent({ props: { isCollapsed: false } });
expect(getByTestId('main-sidebar-version-control')).toBeInTheDocument();