From fbab93fbd67e88b7e085cf9c69c1ef81427f5525 Mon Sep 17 00:00:00 2001 From: afc163 Date: Sat, 11 Aug 2018 11:23:42 +0800 Subject: [PATCH] fix anchor test fails a lot again --- components/anchor/__tests__/Anchor.test.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/anchor/__tests__/Anchor.test.js b/components/anchor/__tests__/Anchor.test.js index 3a1a324bf1..ea67e51572 100644 --- a/components/anchor/__tests__/Anchor.test.js +++ b/components/anchor/__tests__/Anchor.test.js @@ -62,11 +62,11 @@ describe('Anchor Render', () => { wrapper.instance().handleScrollTo('##API'); expect(wrapper.instance().state.activeLink).toBe('##API'); expect(scrollToSpy).not.toHaveBeenCalled(); - await new Promise(resolve => setTimeout(resolve, 50)); - expect(scrollToSpy).toHaveBeenCalled(); + await new Promise(resolve => setTimeout(resolve, 100)); expect(wrapper.instance().animating).toBe(true); await new Promise(resolve => setTimeout(resolve, 1000)); expect(wrapper.instance().animating).toBe(false); + expect(scrollToSpy).toHaveBeenCalled(); }); it('should remove listener when unmount', async () => {