workspaceSidebarTerminologyI18n.test.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { describe, expect, it } from "vitest";
  2. import enUS from "@/i18n/locales/en-US.js";
  3. import zhCN from "@/i18n/locales/zh-CN.js";
  4. import { readFileSync } from "node:fs";
  5. import { fileURLToPath } from "node:url";
  6. const pluginStorePageSource = readFileSync(
  7. fileURLToPath(new URL("../src/settings/PluginStorePage.tsx", import.meta.url)),
  8. "utf8",
  9. );
  10. const workspaceShellSource = readFileSync(
  11. fileURLToPath(
  12. new URL("../src/app-shell/WorkspaceShellLayout.tsx", import.meta.url),
  13. ),
  14. "utf8",
  15. );
  16. describe("Workspace Sidebar terminology", () => {
  17. it("names the plugin entry as the plugin marketplace", () => {
  18. expect(enUS["workspace.openPluginsSettings"]).toBe("Plugin Marketplace");
  19. expect(zhCN["workspace.openPluginsSettings"]).toBe("插件市场");
  20. });
  21. it("uses the plugin marketplace terminology for the marketplace page title", () => {
  22. expect(pluginStorePageSource).toContain(
  23. 'intl.formatMessage({ id: "workspace.openPluginsSettings" })',
  24. );
  25. });
  26. it("uses the plugin marketplace terminology for desktop and mobile detail breadcrumbs", () => {
  27. expect(
  28. workspaceShellSource.match(
  29. /sectionLabel=\{intl\.formatMessage\(\{\s*id: "workspace\.openPluginsSettings",\s*\}\)\}/g,
  30. ),
  31. ).toHaveLength(2);
  32. });
  33. });