feat: add i18n support for scaffolder-react plugin

Signed-off-by: JounQin <admin@1stg.me>
This commit is contained in:
JounQin
2024-12-11 18:17:29 +08:00
parent f8ee2c76de
commit 48aab132f6
18 changed files with 257 additions and 77 deletions
@@ -1,19 +1,20 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { renderInTestApp } from '@backstage/test-utils';
import { ExampleFetchComponent } from './ExampleFetchComponent';
describe('ExampleFetchComponent', () => {
it('renders the user table', async () => {
render(<ExampleFetchComponent />);
const { getAllByText, getByAltText, getByText, findByRole } =
await renderInTestApp(<ExampleFetchComponent />);
// Wait for the table to render
const table = await screen.findByRole('table');
const nationality = screen.getAllByText('GB');
const table = await findByRole('table');
const nationality = getAllByText('GB');
// Assert that the table contains the expected user data
expect(table).toBeInTheDocument();
expect(screen.getByAltText('Carolyn')).toBeInTheDocument();
expect(screen.getByText('Carolyn Moore')).toBeInTheDocument();
expect(screen.getByText('carolyn.moore@example.com')).toBeInTheDocument();
expect(getByAltText('Carolyn')).toBeInTheDocument();
expect(getByText('Carolyn Moore')).toBeInTheDocument();
expect(getByText('carolyn.moore@example.com')).toBeInTheDocument();
expect(nationality[0]).toBeInTheDocument();
});
});