Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

949 B
Raw Blame
import { describe, expect, it } from "vite-plus/test";
import { configurationWarnings } from "./configuration-warnings";

type Services = Parameters<typeof configurationWarnings>[0];

const services = (storage: Partial<Services["storage"]>) =>
  ({
    email: { configured: true, status: "ok" },
    redis: { status: "not_configured" },
    storage: { configured: true, status: "ok", ...storage },
  }) as unknown as Services;

describe("configurationWarnings", () => {
  it("doesn't warn about upload-only storage that answers 403", () => {
    expect(
      configurationWarnings(
        services({ status: "warning", errorCode: "HTTP_403" }),
        false,
        2,
      ),
    ).toEqual([]);
  });

  it("warns when storage is unreachable", () => {
    expect(
      configurationWarnings(
        services({ status: "down", errorCode: "ECONNREFUSED" }),
        false,
        2,
      ),
    ).toEqual(["storage_unreachable"]);
  });
});