From 25fe090e67e7cff528b853add8dbf6af7a01cf22 Mon Sep 17 00:00:00 2001 From: Keith Grant Date: Wed, 24 Jun 2020 11:38:28 -0700 Subject: [PATCH] delete un-workable test for useThrottle --- .../components/JobList/useThrottle.test.jsx | 46 ------------------- 1 file changed, 46 deletions(-) delete mode 100644 awx/ui_next/src/components/JobList/useThrottle.test.jsx diff --git a/awx/ui_next/src/components/JobList/useThrottle.test.jsx b/awx/ui_next/src/components/JobList/useThrottle.test.jsx deleted file mode 100644 index 0f5e9aa88a..0000000000 --- a/awx/ui_next/src/components/JobList/useThrottle.test.jsx +++ /dev/null @@ -1,46 +0,0 @@ -import React from 'react'; -import { act } from 'react-dom/test-utils'; -import { mount } from 'enzyme'; -import useThrottle from './useThrottle'; - -function TestInner() { - return
; -} -function Test({ value }) { - const throttled = useThrottle(value, 500); - return ; -} - -jest.useFakeTimers(); - -describe('useThrottle', () => { - test.skip('should throttle value', async () => { - const mockTime = { value: 1000 }; - const realDateNow = Date.now.bind(global.Date); - const dateNowStub = jest.fn(() => mockTime.value); - global.Date.now = dateNowStub; - let wrapper; - await act(async () => { - wrapper = await mount(); - }); - - wrapper.setProps({ - value: 4, - }); - - expect(wrapper.find('TestInner').prop('throttled')).toEqual(3); - jest.advanceTimersByTime(501); - mockTime.value = 1510; - wrapper.setProps({ - value: 2, - }); - wrapper.setProps({ - value: 4, - }); - wrapper.update(); - expect(wrapper.find('TestInner').prop('throttled')).toEqual(4); - - // Date.now.restore(); - global.Date.now = realDateNow; - }); -});