Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/serhalp/npm.report. Audit, visualize, share, and track your npm org's trust signals. npm.report
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940import { render, screen } from "@testing-library/svelte";import { describe, expect, test, vi } from "vitest";import ExternalView from "./ExternalView.svelte";
describe("ExternalView", () => { test("renders the empty state when every maintainer is a member", () => { render(ExternalView, { props: { report: { rows: [], distinctUsers: 0, byUser: [] }, onToast: vi.fn(), }, });
expect(screen.getByText("No external maintainers")).toBeInTheDocument(); expect(screen.getAllByText("0")).toHaveLength(2); });
test("renders by-user and detail tables for non-member publish access", () => { render(ExternalView, { props: { report: { distinctUsers: 1, byUser: [{ user: "mallory", count: 2 }], rows: [ { user: "mallory", pkg: "alpha" }, { user: "mallory", pkg: "beta" }, ], }, onToast: vi.fn(), }, });
expect(screen.getByText("By user — non-members with live publish rights")).toBeInTheDocument(); expect(screen.getByText("Detail — 2 access grants")).toBeInTheDocument(); expect(screen.getAllByText("mallory")).toHaveLength(3); expect(screen.getByText("alpha")).toBeInTheDocument(); expect(screen.getByText("beta")).toBeInTheDocument(); });});