Add base tests

This commit is contained in:
MartinBraquet
2025-08-04 10:26:19 +02:00
parent c284983b4b
commit ed515fa3fc
11 changed files with 4041 additions and 20 deletions

View File

@@ -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>
);
}

View 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');
});
});