From 465a1f0711a37b02299627ea19a74058bba6695d Mon Sep 17 00:00:00 2001 From: Kiril Kartunov Date: Wed, 29 Jan 2025 09:56:20 +0200 Subject: [PATCH 1/3] test: droping sidebar tests as in master --- .../__snapshots__/index.jsx.snap | 49 ---------- .../Sidebar/FiltersEditor/index.jsx | 89 ------------------- .../challenge-listing/Sidebar/Footer.jsx | 11 --- .../Sidebar/__snapshots__/Footer.jsx.snap | 75 ---------------- .../Sidebar/__snapshots__/index.jsx.snap | 41 --------- .../challenge-listing/Sidebar/index.jsx | 74 --------------- 6 files changed, 339 deletions(-) delete mode 100644 __tests__/shared/components/challenge-listing/Sidebar/FiltersEditor/__snapshots__/index.jsx.snap delete mode 100644 __tests__/shared/components/challenge-listing/Sidebar/FiltersEditor/index.jsx delete mode 100644 __tests__/shared/components/challenge-listing/Sidebar/Footer.jsx delete mode 100644 __tests__/shared/components/challenge-listing/Sidebar/__snapshots__/Footer.jsx.snap delete mode 100644 __tests__/shared/components/challenge-listing/Sidebar/__snapshots__/index.jsx.snap delete mode 100644 __tests__/shared/components/challenge-listing/Sidebar/index.jsx diff --git a/__tests__/shared/components/challenge-listing/Sidebar/FiltersEditor/__snapshots__/index.jsx.snap b/__tests__/shared/components/challenge-listing/Sidebar/FiltersEditor/__snapshots__/index.jsx.snap deleted file mode 100644 index 1c47d69468..0000000000 --- a/__tests__/shared/components/challenge-listing/Sidebar/FiltersEditor/__snapshots__/index.jsx.snap +++ /dev/null @@ -1,49 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Matches shallow shapshot 1`] = ` -
-

- My filters -

- - Done - - -
- Drag the filters to set the order you prefer; use the "x" mark to delete the filter(s) you don't need. -
-
-`; diff --git a/__tests__/shared/components/challenge-listing/Sidebar/FiltersEditor/index.jsx b/__tests__/shared/components/challenge-listing/Sidebar/FiltersEditor/index.jsx deleted file mode 100644 index dadcea411d..0000000000 --- a/__tests__/shared/components/challenge-listing/Sidebar/FiltersEditor/index.jsx +++ /dev/null @@ -1,89 +0,0 @@ -import React from 'react'; -import _ from 'lodash'; -import Renderer from 'react-test-renderer/shallow'; -import TU from 'react-dom/test-utils'; -import FiltersEditor from 'components/challenge-listing/Sidebar/FiltersEditor'; - -const changeFilterName = jest.fn(); -const deleteSavedFilter = jest.fn(); -const dragSavedFilterMove = jest.fn(); -const dragSavedFilterStart = jest.fn(); -const resetFilterName = jest.fn(); -const setEditSavedFiltersMode = jest.fn(); -const updateAllSavedFilters = jest.fn(); -const updateSavedFilter = jest.fn(); - -const mockDatas = [ - { - changeFilterName, - deleteSavedFilter, - dragState: {}, - dragSavedFilterMove, - dragSavedFilterStart, - resetFilterName, - savedFilters: [{ id: '1', name: 'name' }], - setEditSavedFiltersMode, - updateAllSavedFilters, - updateSavedFilter, - }, -]; - -test('Matches shallow shapshot', () => { - const renderer = new Renderer(); - - _.forEach(mockDatas, (data) => { - renderer.render(( - - )); - expect(renderer.getRenderOutput()).toMatchSnapshot(); - }); -}); - -class Wrapper extends React.Component { - componentDidMount() {} - - render() { - return ; - } -} - -test.skip('handle events', () => { - const instance = TU.renderIntoDocument(()); - /* - NOTE: This is broken by transition to the standard themeable button. - let matches = TU.findAllInRenderedTree(instance, item => - item && item.className && item.className.match('done-button')); - expect(matches).toHaveLength(1); - TU.Simulate.click(matches[0]); - expect(setEditSavedFiltersMode).toHaveBeenCalledWith(false); - */ - - let matches = TU.scryRenderedDOMComponentsWithTag(instance, 'input'); - expect(matches).toHaveLength(1); - TU.Simulate.change(matches[0], { target: { value: 'value' } }); - expect(changeFilterName).toHaveBeenCalledWith(0, 'value'); - expect(resetFilterName).not.toHaveBeenCalled(); - TU.Simulate.keyDown(matches[0], { key: 'Enter' }); - expect(resetFilterName).not.toHaveBeenCalled(); - TU.Simulate.keyDown(matches[0], { key: 'A' }); - expect(resetFilterName).not.toHaveBeenCalled(); - TU.Simulate.keyDown(matches[0], { key: 'Escape' }); - expect(resetFilterName).toHaveBeenCalledWith(0); - TU.Simulate.blur(matches[0]); - expect(updateSavedFilter).toHaveBeenCalled(); - - /* - matches = TU.scryRenderedDOMComponentsWithClass(instance, 'right'); - expect(matches).toHaveLength(1); - TU.Simulate.click(matches[0]); - expect(deleteSavedFilter).toHaveBeenCalledWith('1'); - */ - - matches = TU.scryRenderedDOMComponentsWithClass(instance, 'ActiveFilterItem'); - expect(dragSavedFilterMove).not.toHaveBeenCalled(); - TU.Simulate.drag(matches[0]); - expect(dragSavedFilterMove).toHaveBeenCalled(); - expect(dragSavedFilterStart).not.toHaveBeenCalled(); - TU.Simulate.dragStart(matches[0]); - expect(dragSavedFilterStart).toHaveBeenCalled(); -}); diff --git a/__tests__/shared/components/challenge-listing/Sidebar/Footer.jsx b/__tests__/shared/components/challenge-listing/Sidebar/Footer.jsx deleted file mode 100644 index 4b9d1ff10e..0000000000 --- a/__tests__/shared/components/challenge-listing/Sidebar/Footer.jsx +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; -import Renderer from 'react-test-renderer/shallow'; -import Footer from 'components/challenge-listing/Sidebar/Footer'; - -test('Matches shallow shapshot', () => { - const renderer = new Renderer(); - renderer.render(( -