Untitled
unknown
typescript
2 years ago
1.3 kB
9
Indexable
import { render, screen, fireEvent } from 'vitest';
import { it, expect } from 'vitest';
import React from 'react';
import Welcome from './Welcome';
it('should render the "Try the Sandbox" button', () => {
render(<Welcome />);
const trySandboxButton = screen.getByText('Try the Sandbox');
expect(trySandboxButton).toBeTruthy(); // Check if the button exists
});
it('should open the "Try the Sandbox" modal when clicked', async () => {
render(<Welcome />);
const trySandboxButton = screen.getByText('Try the Sandbox');
fireEvent.click(trySandboxButton);
const modalTitle = await screen.findByText('Sign Up');
expect(modalTitle).toBeTruthy(); // Check if the modal title exists
});
it('should render the "Contact Us" button', () => {
render(<Welcome />);
const contactUsButton = screen.getByText('Contact Us');
expect(contactUsButton).toBeTruthy(); // Check if the button exists
});
it('should open the "Contact Us" modal when clicked', async () => {
render(<Welcome />);
const contactUsButton = screen.getByText('Contact Us');
fireEvent.click(contactUsButton);
const modalTitle = await screen.findByText('Contact Us Form');
expect(modalTitle).toBeTruthy(); // Check if the modal title exists
});
// Add more test cases for other buttons as needed
Editor is loading...