]> source.dussan.org Git - sonarqube.git/commitdiff
Fix broken web unit test
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Thu, 28 Sep 2017 13:32:14 +0000 (15:32 +0200)
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>
Fri, 29 Sep 2017 15:09:48 +0000 (17:09 +0200)
server/sonar-web/src/main/js/apps/overview/meta/__tests__/MetaTagsSelector-test.js

index 59744a204de315a4deb2fb5f09258a4911ea4441..bc22697f5f33d2c772d5545352e64db1f99464ec 100644 (file)
@@ -26,18 +26,19 @@ jest.mock('../../../../api/components', () => ({
   searchProjectTags: jest.fn()
 }));
 
-jest.useFakeTimers();
+jest.mock('lodash', () => {
+  const lodash = require.requireActual('lodash');
+  lodash.debounce = jest.fn(fn => fn);
+  return lodash;
+});
 
 import { searchProjectTags } from '../../../../api/components';
 
 it('searches tags on mount', () => {
   searchProjectTags.mockImplementation(() => Promise.resolve({ tags: ['foo', 'bar'] }));
-
   mount(
     <MetaTagsSelector position={{}} project="foo" selectedTags={[]} setProjectTags={jest.fn()} />
   );
-  jest.runAllTimers();
-
   expect(searchProjectTags).toBeCalledWith({ ps: 9, q: '' });
 });