Spaces:
Configuration error
Configuration error
Download frontend/__tests__/utils/check-hardcoded-strings.test.tsx from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 1.16 kB
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/__tests__/utils/check-hardcoded-strings.test.tsx
- Command line
-
hf download hf://spaces/flyingdarkdev/README/frontend/__tests__/utils/check-hardcoded-strings.test.tsx
-
curl -L -o check-hardcoded-strings.test.tsx https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/__tests__/utils/check-hardcoded-strings.test.tsx
1.16 kB
| import { render, screen } from "@testing-library/react"; | |
| import { test, expect, describe, vi } from "vitest"; | |
| import { InteractiveChatBox } from "#/components/features/chat/interactive-chat-box"; | |
| import { ChatInput } from "#/components/features/chat/chat-input"; | |
| // Mock react-i18next | |
| vi.mock("react-i18next", () => ({ | |
| useTranslation: () => ({ | |
| t: (key: string) => key, | |
| }), | |
| })); | |
| describe("Check for hardcoded English strings", () => { | |
| test("InteractiveChatBox should not have hardcoded English strings", () => { | |
| const { container } = render( | |
| <InteractiveChatBox | |
| onSubmit={() => {}} | |
| onStop={() => {}} | |
| /> | |
| ); | |
| // Get all text content | |
| const text = container.textContent; | |
| // List of English strings that should be translated | |
| const hardcodedStrings = [ | |
| "What do you want to build?", | |
| ]; | |
| // Check each string | |
| hardcodedStrings.forEach(str => { | |
| expect(text).not.toContain(str); | |
| }); | |
| }); | |
| test("ChatInput should use translation key for placeholder", () => { | |
| render(<ChatInput onSubmit={() => {}} />); | |
| screen.getByPlaceholderText("SUGGESTIONS$WHAT_TO_BUILD"); | |
| }); | |
| }); | |