Release API Tools 0.2.0
Verify / verify (push) Canceled after 0s

This commit is contained in:
2026-09-02 10:18:45 +02:00
parent fbcd0e56d6
commit 98d1ff4afc
35 changed files with 2483 additions and 147 deletions
+33 -3
View File
@@ -1,4 +1,4 @@
import { render, screen } from "@testing-library/react";
import { fireEvent, 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";
@@ -12,9 +12,9 @@ describe("API workbench", () => {
).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.clear(screen.getByLabelText("API description source"));
await user.type(
screen.getByLabelText("OpenAPI source"),
screen.getByLabelText("API description source"),
'not: "unterminated',
);
await user.click(
@@ -26,6 +26,36 @@ describe("API workbench", () => {
).toHaveLength(3);
});
it("opens AsyncAPI operations and derives local message examples", async () => {
const user = userEvent.setup();
render(<Workbench />);
fireEvent.change(screen.getByLabelText("API description source"), {
target: {
value: `asyncapi: 3.1.0
info: { title: Events, version: '1' }
defaultContentType: application/json
channels:
users:
address: users.signed-up
messages:
signedUp: { payload: { type: object, properties: { id: { const: user-1 } } } }
operations:
emit:
action: send
channel: { $ref: '#/channels/users' }
`,
},
});
await user.click(
screen.getByRole("button", { name: "Analyse description" }),
);
expect(screen.getAllByText("SEND", { exact: true })).not.toHaveLength(0);
expect(
screen.getAllByText("users.signed-up", { exact: true }),
).toHaveLength(2);
expect(screen.getAllByText(/user-1/iu)).toHaveLength(2);
});
it("shows security, comparison and exchange workspaces", async () => {
const user = userEvent.setup();
render(<Workbench />);