@@ -51,16 +51,6 @@ describe('MockDataGeneratorModal', () => {
51
51
expect ( screen . queryByTestId ( 'generate-mock-data-modal' ) ) . to . not . exist ;
52
52
} ) ;
53
53
54
- it ( 'renders the correct step when currentStep is set' , ( ) => {
55
- renderModal ( { currentStep : MockDataGeneratorStep . SCHEMA_CONFIRMATION } ) ;
56
-
57
- expect (
58
- screen . getByTestId (
59
- `generate-mock-data-step-${ MockDataGeneratorStep . SCHEMA_CONFIRMATION } `
60
- )
61
- ) . to . exist ;
62
- } ) ;
63
-
64
54
it ( 'calls setIsOpen(false) when the modal is closed' , ( ) => {
65
55
renderModal ( ) ;
66
56
@@ -85,12 +75,18 @@ describe('MockDataGeneratorModal', () => {
85
75
) . to . equal ( 'true' ) ;
86
76
} ) ;
87
77
88
- it ( 'renders the next step button with the correct label on each step' , ( ) => {
89
- renderModal ( ) ;
90
-
91
- Object . values ( StepButtonLabelMap ) . forEach ( ( label ) => {
92
- expect ( screen . getByTestId ( 'next-step-button' ) ) . to . have . text ( label ) ;
93
- screen . getByTestId ( 'next-step-button' ) . click ( ) ;
78
+ describe ( 'when rendering the modal in a specific step' , ( ) => {
79
+ const steps = Object . values ( MockDataGeneratorStep ) . filter (
80
+ ( step ) => typeof step === 'number'
81
+ ) as MockDataGeneratorStep [ ] ;
82
+
83
+ steps . forEach ( ( currentStep ) => {
84
+ it ( `renders the button with the correct label when the user is in step "${ currentStep } "` , ( ) => {
85
+ renderModal ( { currentStep } ) ;
86
+ expect ( screen . getByTestId ( 'next-step-button' ) ) . to . have . text (
87
+ StepButtonLabelMap [ currentStep ]
88
+ ) ;
89
+ } ) ;
94
90
} ) ;
95
91
} ) ;
96
92
} ) ;
0 commit comments