Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

885 B
Raw Blame
import { describe, expect, test, vi } from "vitest";

import { createDockerRemovalConfirmation } from "./confirm-docker-container-removal";

describe("createDockerRemovalConfirmation", () => {
  test("does not remove containers before explicit confirmation", () => {
    const remove = vi.fn();
    const t = vi.fn((key: string, values?: Record<string, string>) => `${key}:${JSON.stringify(values)}`);

    const confirmation = createDockerRemovalConfirmation(
      [{ name: "sonarr" }, { name: "radarr" }],
      t as never,
      "Remove",
      remove,
    );

    expect(remove).not.toHaveBeenCalled();
    expect(confirmation.title).toContain('"count":"2"');
    expect(confirmation.children).toContain('"names":"sonarr, radarr"');
    expect(confirmation.confirmProps.children).toBe("Remove");

    confirmation.onConfirm();
    expect(remove).toHaveBeenCalledOnce();
  });
});