workspaceArchivedTaskActionTooltip.test.ts 1.0 KB

12345678910111213141516171819202122232425262728
  1. import { readFileSync } from "node:fs";
  2. import { resolve } from "node:path";
  3. import { describe, expect, it } from "vitest";
  4. const archivedSectionSource = readFileSync(
  5. resolve(process.cwd(), "packages/ui/src/WorkspaceArchivedTasksFlatSection.tsx"),
  6. "utf8",
  7. );
  8. const englishLocaleSource = readFileSync(
  9. resolve(process.cwd(), "packages/ui/src/i18n/locales/en-US.ts"),
  10. "utf8",
  11. );
  12. describe("WorkspaceArchivedTasksFlatSection action tooltips", () => {
  13. it("为取消归档和删除 action 使用共享 tooltip", () => {
  14. expect(archivedSectionSource).toMatch(
  15. /<ControlHintTooltip title=\{unarchiveLabel\}[\s\S]*?aria-label=\{unarchiveLabel\}/,
  16. );
  17. expect(archivedSectionSource).toMatch(
  18. /<ControlHintTooltip title=\{deleteLabel\}[\s\S]*?aria-label=\{deleteLabel\}/,
  19. );
  20. });
  21. it("使用完整的 task action 英文文案", () => {
  22. expect(englishLocaleSource).toContain('"taskList.unarchive": "Unarchive task"');
  23. expect(englishLocaleSource).toContain('"taskList.delete": "Delete task"');
  24. });
  25. });