ci: enhance GitHub Actions workflow for performance and caching
Some checks failed
CI/CD Pipeline / Quick Checks (pull_request) Failing after 9s
CI/CD Pipeline / ESLint (pull_request) Has been skipped
CI/CD Pipeline / Test & Coverage (pull_request) Has been skipped
CI/CD Pipeline / Build Application (pull_request) Has been skipped
CI/CD Pipeline / Security Audit (pull_request) Has been skipped

This commit is contained in:
2025-05-27 13:02:05 +02:00
parent 76dd9cd838
commit 9498026e71
5 changed files with 192 additions and 37 deletions

View File

@ -1,4 +1,4 @@
import { render } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import RootLayout, { metadata } from '../layout';
@ -17,20 +17,19 @@ jest.mock('../globals.css', () => ({}));
describe('RootLayout', () => {
it('renders children correctly', () => {
const testContent = <div data-testid="test-content">Test content</div>;
const { getByTestId } = render(<RootLayout>{testContent}</RootLayout>);
const testContent = <div data-testid='test-content'>Test content</div>;
render(<RootLayout>{testContent}</RootLayout>);
expect(getByTestId('test-content')).toBeInTheDocument();
expect(getByTestId('test-content')).toHaveTextContent('Test content');
expect(screen.getByTestId('test-content')).toBeInTheDocument();
expect(screen.getByTestId('test-content')).toHaveTextContent('Test content');
});
it('creates proper HTML structure with lang attribute', () => {
const testContent = <div>Test</div>;
const { container } = render(<RootLayout>{testContent}</RootLayout>);
// The component returns JSX with html and body elements
// We can test that the component renders without errors
expect(container.firstChild).toBeInTheDocument();
it('creates proper HTML structure', () => {
const testContent = <div data-testid='layout-child'>Test</div>;
render(<RootLayout>{testContent}</RootLayout>);
// Verify the child component is rendered correctly
expect(screen.getByTestId('layout-child')).toBeInTheDocument();
});
it('has correct metadata export', () => {
@ -39,12 +38,12 @@ describe('RootLayout', () => {
expect(metadata.description).toBe('Generated by create next app');
});
it('applies font classes correctly', () => {
// Test that the component can be instantiated and called
const testContent = <div>Test</div>;
const renderResult = render(<RootLayout>{testContent}</RootLayout>);
// Just ensure it renders without throwing errors
expect(renderResult.container).toBeInTheDocument();
it('renders without errors', () => {
const testContent = <div data-testid='render-test'>Test</div>;
const view = render(<RootLayout>{testContent}</RootLayout>);
// Verify the component renders successfully
expect(screen.getByTestId('render-test')).toBeInTheDocument();
expect(view.container).toBeInTheDocument();
});
});
});