Release API Tools 0.1.0

This commit is contained in:
2026-09-01 12:39:23 +02:00
commit fbcd0e56d6
63 changed files with 10155 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, expect, it } from "vitest";
import { Workbench } from "../../src/components/Workbench";
describe("API workbench", () => {
it("navigates operations and retains a model after invalid source", async () => {
const user = userEvent.setup();
render(<Workbench />);
expect(
screen.getByRole("heading", { name: "API Tools" }),
).toBeInTheDocument();
expect(screen.getAllByText("GET", { exact: true })).toHaveLength(2);
expect(screen.getByText(/curl --request GET/iu)).toBeInTheDocument();
await user.clear(screen.getByLabelText("OpenAPI source"));
await user.type(
screen.getByLabelText("OpenAPI source"),
'not: "unterminated',
);
await user.click(
screen.getByRole("button", { name: "Analyse description" }),
);
expect(screen.getByRole("alert")).toHaveTextContent(/last successful/iu);
expect(
screen.getAllByText("/books/{bookId}", { exact: true }),
).toHaveLength(3);
});
it("shows security, comparison and exchange workspaces", async () => {
const user = userEvent.setup();
render(<Workbench />);
await user.click(screen.getByRole("button", { name: "Security" }));
expect(screen.getByText("bearerAuth", { exact: true })).toBeInTheDocument();
await user.click(screen.getByRole("button", { name: "Compare" }));
expect(screen.getByText(/Operation was added/iu)).toBeInTheDocument();
await user.click(screen.getByRole("button", { name: "Exchanges" }));
expect(
screen.getByRole("cell", {
name: "https://api.example.test/books/book-42",
}),
).toBeInTheDocument();
});
});