We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents e624749 + 75a0125 commit 912ce9eCopy full SHA for 912ce9e
1 file changed
test/useWizard.test.tsx
@@ -160,4 +160,21 @@ describe('useWizard', () => {
160
expect(result.current.isFirstStep).toBe(true);
161
expect(result.current.isLastStep).toBe(false);
162
});
163
+
164
+ test('should thrown error on nextStep', async () => {
165
+ const { result } = renderUseWizardHook();
166
167
+ act(() => {
168
+ result.current.handleStep(() => {
169
+ return Promise.reject(Error('Gotcha'));
170
+ });
171
172
+ result.current.nextStep().catch((error) => {
173
+ expect(error).toEqual(Error('Gotcha'));
174
+ expect(result.error).toEqual(Error('Gotcha'));
175
+ expect(result.current.activeStep).toBe(0);
176
+ expect(result.current.isFirstStep).toBe(true);
177
178
179
180
0 commit comments