Skip to content

Commit ebe5d91

Browse files
committed
Add tests
1 parent e577271 commit ebe5d91

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

packages/compass-collection/src/components/mock-data-generator-modal/mock-data-generator-modal.spec.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,39 @@ describe('MockDataGeneratorModal', () => {
228228
// todo: assert that closing then re-opening the modal after an LLM err removes the err message
229229
});
230230

231+
describe('on the generate data step', () => {
232+
it('enables the Back button', () => {
233+
renderModal({ currentStep: MockDataGeneratorStep.GENERATE_DATA });
234+
235+
expect(
236+
screen
237+
.getByRole('button', { name: 'Back' })
238+
.getAttribute('aria-disabled')
239+
).to.not.equal('true');
240+
});
241+
242+
it('renders the main sections: Prerequisites, steps, and Resources', () => {
243+
renderModal({ currentStep: MockDataGeneratorStep.GENERATE_DATA });
244+
245+
expect(screen.getByText('Prerequisites')).to.exist;
246+
expect(screen.getByText('1. Create a .js file with the following script'))
247+
.to.exist;
248+
expect(screen.getByText('2. Run the script with')).to.exist;
249+
expect(screen.getByText('Resources')).to.exist;
250+
});
251+
252+
it('closes the modal when the Done button is clicked', async () => {
253+
renderModal({ currentStep: MockDataGeneratorStep.GENERATE_DATA });
254+
255+
expect(screen.getByTestId('generate-mock-data-modal')).to.exist;
256+
userEvent.click(screen.getByText('Done'));
257+
await waitFor(
258+
() =>
259+
expect(screen.queryByTestId('generate-mock-data-modal')).to.not.exist
260+
);
261+
});
262+
});
263+
231264
describe('when rendering the modal in a specific step', () => {
232265
const steps = Object.keys(
233266
StepButtonLabelMap

0 commit comments

Comments
 (0)