Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to test timeout in component did mount

it('button shoould start glowing', () => {
        const wrapper = mount(<PlayButton media={{ currentTime: 0, duration: 1 }}/>);
        wrapper.update()
        jest.runAllTimers();
        expect(wrapper.state('glow')).toBe(true);
    });
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #test #timeout #component #mount
ADD COMMENT
Topic
Name
2+3 =