mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-03-29 12:04:04 -04:00
Add base tests
This commit is contained in:
@@ -4,8 +4,14 @@ import React from "react";
|
||||
|
||||
export default function LoadingSpinner() {
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen ">
|
||||
<div className="w-12 h-12 border-4 border-gray-300 border-t-gray-800 rounded-full animate-spin" />
|
||||
<div
|
||||
data-testid="spinner-container"
|
||||
className="flex items-center justify-center min-h-screen"
|
||||
>
|
||||
<div
|
||||
data-testid="spinner"
|
||||
className="w-12 h-12 border-4 border-gray-300 border-t-gray-800 rounded-full animate-spin"
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
17
lib/client/__tests__/LoadingSpinner.test.tsx
Normal file
17
lib/client/__tests__/LoadingSpinner.test.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import LoadingSpinner from '../LoadingSpinner';
|
||||
|
||||
describe('LoadingSpinner', () => {
|
||||
it('renders a loading spinner', () => {
|
||||
render(<LoadingSpinner />);
|
||||
|
||||
// Check if the spinner container is rendered with the correct classes
|
||||
const spinnerContainer = screen.getByTestId('spinner-container');
|
||||
expect(spinnerContainer).toBeInTheDocument();
|
||||
expect(spinnerContainer).toHaveClass('flex', 'items-center', 'justify-center', 'min-h-screen');
|
||||
|
||||
// Check if the spinner has the correct classes
|
||||
const spinner = screen.getByTestId('spinner');
|
||||
expect(spinner).toHaveClass('w-12', 'h-12', 'border-4', 'border-gray-300', 'border-t-gray-800', 'rounded-full', 'animate-spin');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user