This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const is = (val) => ({ | |
| if: (expr) => { | |
| if (expr) | |
| return { | |
| else: () => val, | |
| is: function is() { | |
| return { | |
| if: () => ({ else: () => val, is }), | |
| } | |
| }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const flushEventLoop = () => new Promise(resolve => setImmediate(resolve)); | |
| describe('Lorem ipsum', () => { | |
| it('waits for load', async () => { | |
| functionWithLotsOfMockPromises(); | |
| await waitForComponentToPaint(wrapper); | |
| expect(/**/).toBe(true) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { mount } from 'enzyme'; | |
| import { act } from 'react-dom/test-utils'; | |
| const waitForComponentToPaint = async wrapper => { | |
| await act(async () => { | |
| await new Promise(resolve => setTimeout(resolve)); | |
| wrapper.update(); | |
| }); | |
| }; |