import { describe, it, expect } from "vitest";
import { getEditorCanvasMessages } from "@/features/i18n/messages/editorCanvas";
import { DEFAULT_LOCALE } from "@/features/i18n/locale";

describe("getEditorCanvasMessages", () => {
  it("returns English messages for en locale", () => {
    const t = getEditorCanvasMessages("en");

    expect(t.emptyStateHint).toBe('Click the "Text" button on the left to add your first block.');
    expect(t.previewFallbackTextBlock).toBe("Text block");
    expect(t.previewFallbackButtonBlock).toBe("Button block");
    expect(t.previewFallbackImageBlock).toBe("Image block");
  });

  it("returns Korean messages for ko locale", () => {
    const t = getEditorCanvasMessages("ko");

    expect(t.emptyStateHint).toBe('왼쪽에서 "텍스트" 버튼을 눌러 블록을 추가해 보세요.');
    expect(t.previewFallbackTextBlock).toBe("텍스트 블록");
    expect(t.previewFallbackButtonBlock).toBe("버튼 블록");
    expect(t.previewFallbackImageBlock).toBe("이미지 블록");
  });

  it("falls back to DEFAULT_LOCALE for unsupported locale", () => {
    const fallback = getEditorCanvasMessages(DEFAULT_LOCALE);
    const t = getEditorCanvasMessages("fr" as any);

    expect(t.emptyStateHint).toBe(fallback.emptyStateHint);
    expect(t.previewFallbackTextBlock).toBe(fallback.previewFallbackTextBlock);
  });
});
