Files
duty-teller/webapp-next/src/components/states/ErrorState.test.tsx
Nikolay Tatarinov 16bf1a1043 feat: migrate to Next.js for Mini App and enhance project structure
- Replaced the previous webapp with a new Mini App built using Next.js, improving performance and maintainability.
- Updated the `.gitignore` to exclude Next.js build artifacts and node modules.
- Revised documentation in `AGENTS.md`, `README.md`, and `architecture.md` to reflect the new Mini App structure and technology stack.
- Enhanced Dockerfile to support the new build process for the Next.js application.
- Updated CI workflow to build and test the Next.js application.
- Added new configuration options for the Mini App, including `MINI_APP_SHORT_NAME` for improved deep linking.
- Refactored frontend testing setup to accommodate the new structure and testing framework.
- Removed legacy webapp files and dependencies to streamline the project.
2026-03-03 16:04:08 +03:00

27 lines
893 B
TypeScript

/**
* Unit tests for ErrorState. Ported from webapp/js/ui.test.js showError.
*/
import { describe, it, expect, vi, beforeEach } from "vitest";
import { render, screen } from "@testing-library/react";
import { ErrorState } from "./ErrorState";
import { resetAppStore } from "@/test/test-utils";
describe("ErrorState", () => {
beforeEach(() => resetAppStore());
it("renders error message", () => {
render(<ErrorState message="Network error" onRetry={undefined} />);
expect(screen.getByText("Network error")).toBeInTheDocument();
});
it("renders Retry button when onRetry provided", () => {
const onRetry = vi.fn();
render(<ErrorState message="Fail" onRetry={onRetry} />);
const retry = screen.getByRole("button", { name: /retry|повторить/i });
expect(retry).toBeInTheDocument();
retry.click();
expect(onRetry).toHaveBeenCalled();
});
});