hookCreateButtonSize.test.ts 754 B

123456789101112131415161718192021
  1. import { readFile } from "node:fs/promises";
  2. import { describe, expect, it } from "vitest";
  3. describe("Hook create button", () => {
  4. it("routes the compact create button through the shared header actions", async () => {
  5. const hooks = await readFile(
  6. new URL("../src/settings/HooksSection.tsx", import.meta.url),
  7. "utf8",
  8. );
  9. const shared = await readFile(
  10. new URL("../src/settings/SettingsResourceHeaderActions.tsx", import.meta.url),
  11. "utf8",
  12. );
  13. expect(hooks).toContain("<SettingsResourceHeaderActions");
  14. expect(hooks).toContain('newActionId="settings.hooks.add"');
  15. expect(shared).toMatch(
  16. /size="default"\s+className="rounded-lg"\s+data-settings-create-action=\{newActionId\}/,
  17. );
  18. });
  19. });