Merge pull request #2039 from modelcontextprotocol/v2/chore/1959-no-floating-promises
chore(lint): enable @typescript-eslint/no-floating-promises in all five ESLint scopes
This commit is contained in:
commit
405d0f4d0d
13 changed files with 656 additions and 113 deletions
|
|
@ -114,8 +114,10 @@ export const ServerInfoNotReported: Story = {
|
|||
},
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
expect(canvas.queryByText("my-catalog-name")).not.toBeInTheDocument();
|
||||
expect(canvas.getAllByText(SERVER_INFO_NOT_REPORTED_LABEL)).toHaveLength(2);
|
||||
await expect(canvas.queryByText("my-catalog-name")).not.toBeInTheDocument();
|
||||
await expect(
|
||||
canvas.getAllByText(SERVER_INFO_NOT_REPORTED_LABEL),
|
||||
).toHaveLength(2);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -195,11 +197,11 @@ export const WithOAuthIdToken: Story = {
|
|||
},
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
expect(canvas.getByText("ID Token")).toBeInTheDocument();
|
||||
await expect(canvas.getByText("ID Token")).toBeInTheDocument();
|
||||
// Only the ID token is a JWT here, so exactly one decode toggle is offered.
|
||||
await userEvent.click(
|
||||
canvas.getByRole("button", { name: "Decode JWT for ID Token" }),
|
||||
);
|
||||
expect(canvas.getByText(/"sub": "user-42"/)).toBeInTheDocument();
|
||||
await expect(canvas.getByText(/"sub": "user-42"/)).toBeInTheDocument();
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -77,6 +77,6 @@ export const WithEntries: Story = {
|
|||
},
|
||||
// List scrollbar reserves a gutter and stays hidden when idle (#1474).
|
||||
play: async ({ canvasElement }) => {
|
||||
expectScrollbarGutterIdleHidden(canvasElement);
|
||||
await expectScrollbarGutterIdleHidden(canvasElement);
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ export const AllVisible: Story = {
|
|||
args: { visibleDirections: { client: true, server: true } },
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
expect(
|
||||
await expect(
|
||||
canvas.getByRole("button", { name: "client → server" }),
|
||||
).toBeInTheDocument();
|
||||
expect(
|
||||
await expect(
|
||||
canvas.getByRole("button", { name: "Deselect All" }),
|
||||
).toBeInTheDocument();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ type Story = StoryObj<typeof MonitoringControls>;
|
|||
export const AllTabs: Story = {
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
expect(canvas.getByRole("radio", { name: "Logs" })).toBeChecked();
|
||||
await expect(canvas.getByRole("radio", { name: "Logs" })).toBeChecked();
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -28,6 +28,6 @@ export const StdioServer: Story = {
|
|||
args: { tabs: ["Logs", "Protocol"], value: "Protocol" },
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
expect(canvas.queryByRole("radio", { name: "Network" })).toBeNull();
|
||||
await expect(canvas.queryByRole("radio", { name: "Network" })).toBeNull();
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ type Story = StoryObj<typeof MonitoringScreen>;
|
|||
export const Logs: Story = {
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
expect(canvas.getByText("Log stream")).toBeInTheDocument();
|
||||
await expect(canvas.getByText("Log stream")).toBeInTheDocument();
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -55,6 +55,6 @@ export const Protocol: Story = {
|
|||
args: { value: "Protocol" },
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
expect(canvas.getByText("Request history")).toBeInTheDocument();
|
||||
await expect(canvas.getByText("Request history")).toBeInTheDocument();
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export const WithEntries: Story = {
|
|||
args: { entries: sample },
|
||||
// List scrollbar reserves a gutter and stays hidden when idle (#1474).
|
||||
play: async ({ canvasElement }) => {
|
||||
expectScrollbarGutterIdleHidden(canvasElement);
|
||||
await expectScrollbarGutterIdleHidden(canvasElement);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -45,14 +45,14 @@ export const Default: Story = {
|
|||
// Mantine renders the modal in a portal at document.body.
|
||||
const body = within(canvasElement.ownerDocument.body);
|
||||
await body.findByText("Output schema validation");
|
||||
expect(body.getByText(/open_pattern_editor/)).toBeInTheDocument();
|
||||
await expect(body.getByText(/open_pattern_editor/)).toBeInTheDocument();
|
||||
const details = body.getByLabelText(
|
||||
"Validation details",
|
||||
) as HTMLTextAreaElement;
|
||||
expect(details.value).toContain(
|
||||
await expect(details.value).toContain(
|
||||
"data/samples/0 must NOT have additional properties",
|
||||
);
|
||||
expect(details.readOnly).toBe(true);
|
||||
await expect(details.readOnly).toBe(true);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -122,11 +122,11 @@ export const Sampling: Story = {
|
|||
play: async ({ canvasElement, args }) => {
|
||||
const body = within(canvasElement.ownerDocument.body);
|
||||
await body.findByText("Sampling Request");
|
||||
expect(
|
||||
await expect(
|
||||
body.getByText("The server is requesting an LLM completion."),
|
||||
).toBeInTheDocument();
|
||||
await userEvent.click(body.getByRole("button", { name: "Send Response" }));
|
||||
expect(args.onSamplingRespond).toHaveBeenCalled();
|
||||
await expect(args.onSamplingRespond).toHaveBeenCalled();
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -144,8 +144,8 @@ export const SamplingInputRequired: Story = {
|
|||
play: async ({ canvasElement }) => {
|
||||
const body = within(canvasElement.ownerDocument.body);
|
||||
await body.findByText("Sampling Request");
|
||||
expect(body.getByText("input_required")).toBeInTheDocument();
|
||||
expect(body.getByText(/sent back as a retry/i)).toBeInTheDocument();
|
||||
await expect(body.getByText("input_required")).toBeInTheDocument();
|
||||
await expect(body.getByText(/sent back as a retry/i)).toBeInTheDocument();
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -172,11 +172,11 @@ export const ElicitationForm: Story = {
|
|||
play: async ({ canvasElement, args }) => {
|
||||
const body = within(canvasElement.ownerDocument.body);
|
||||
await body.findByText("Elicitation Request");
|
||||
expect(
|
||||
await expect(
|
||||
body.getByText(/Please provide your database connection details/),
|
||||
).toBeInTheDocument();
|
||||
await userEvent.click(body.getByRole("button", { name: "Submit" }));
|
||||
expect(args.onElicitationRespond).toHaveBeenCalledWith({
|
||||
await expect(args.onElicitationRespond).toHaveBeenCalledWith({
|
||||
action: "accept",
|
||||
content: {},
|
||||
});
|
||||
|
|
@ -207,7 +207,7 @@ export const ElicitationUrl: Story = {
|
|||
play: async ({ canvasElement }) => {
|
||||
const body = within(canvasElement.ownerDocument.body);
|
||||
await body.findByText("Elicitation Request");
|
||||
expect(
|
||||
await expect(
|
||||
body.getByText("https://example.com/authorize?token=abc123"),
|
||||
).toBeInTheDocument();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ export const WithEntries: Story = {
|
|||
// bar never overlays the cards, and uses type="scroll" so it stays hidden
|
||||
// when idle rather than appearing on hover (#1474).
|
||||
play: async ({ canvasElement }) => {
|
||||
expectScrollbarGutterIdleHidden(canvasElement);
|
||||
await expectScrollbarGutterIdleHidden(canvasElement);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ export const Default: Story = {
|
|||
// chevron points down.
|
||||
play: async ({ canvasElement }) => {
|
||||
const transforms = chevronTransforms(canvasElement);
|
||||
expect(transforms).toHaveLength(3);
|
||||
for (const t of transforms) expect(t).toBe(ROTATED_DOWN);
|
||||
await expect(transforms).toHaveLength(3);
|
||||
for (const t of transforms) await expect(t).toBe(ROTATED_DOWN);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -122,9 +122,9 @@ export const Collapsed: Story = {
|
|||
},
|
||||
play: async ({ canvasElement }) => {
|
||||
const transforms = chevronTransforms(canvasElement);
|
||||
expect(transforms).toHaveLength(3);
|
||||
await expect(transforms).toHaveLength(3);
|
||||
// Identity matrix = the right-pointing arrow's natural 0° (not rotated).
|
||||
for (const t of transforms) expect(t).toBe(NOT_ROTATED);
|
||||
for (const t of transforms) await expect(t).toBe(NOT_ROTATED);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -140,10 +140,10 @@ export const EmptySectionCollapsed: Story = {
|
|||
},
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
expect(canvas.getByText("Subscriptions (0)")).toBeInTheDocument();
|
||||
await expect(canvas.getByText("Subscriptions (0)")).toBeInTheDocument();
|
||||
const transforms = chevronTransforms(canvasElement);
|
||||
const downCount = transforms.filter((t) => t === ROTATED_DOWN).length;
|
||||
expect(downCount).toBe(2); // URIs + Templates down, Subscriptions right
|
||||
await expect(downCount).toBe(2); // URIs + Templates down, Subscriptions right
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -158,11 +158,11 @@ export const SubscriptionsUnsupported: Story = {
|
|||
},
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
expect(canvas.queryByText(/Subscriptions/)).not.toBeInTheDocument();
|
||||
await expect(canvas.queryByText(/Subscriptions/)).not.toBeInTheDocument();
|
||||
// Only the two remaining sections render, both open → both chevrons down.
|
||||
const transforms = chevronTransforms(canvasElement);
|
||||
expect(transforms).toHaveLength(2);
|
||||
for (const t of transforms) expect(t).toBe(ROTATED_DOWN);
|
||||
await expect(transforms).toHaveLength(2);
|
||||
for (const t of transforms) await expect(t).toBe(ROTATED_DOWN);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -45,10 +45,12 @@ export const Static: Story = {
|
|||
},
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
expect(canvas.getByText(URI)).toBeInTheDocument();
|
||||
await expect(canvas.getByText(URI)).toBeInTheDocument();
|
||||
// Copy button is present; there's no expand control in the static card.
|
||||
expect(canvas.getByRole("button", { name: "Copy" })).toBeInTheDocument();
|
||||
expect(
|
||||
await expect(
|
||||
canvas.getByRole("button", { name: "Copy" }),
|
||||
).toBeInTheDocument();
|
||||
await expect(
|
||||
canvas.queryByRole("button", { name: /^Expand resource/ }),
|
||||
).not.toBeInTheDocument();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ export const Nested: Story = {
|
|||
},
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
expect(
|
||||
await expect(
|
||||
canvas.getByRole("heading", { name: "Structured Output" }),
|
||||
).toBeInTheDocument();
|
||||
// The section starts expanded, so the payload is visible without a click.
|
||||
|
|
@ -78,9 +78,9 @@ export const Large: Story = {
|
|||
}
|
||||
// Capped: the visible height stays at the section's `mah`, well under the
|
||||
// payload's natural height…
|
||||
expect(viewport.clientHeight).toBeLessThanOrEqual(400);
|
||||
await expect(viewport.clientHeight).toBeLessThanOrEqual(400);
|
||||
// …and the overflow is reachable by scrolling rather than clipped away.
|
||||
expect(viewport.scrollHeight).toBeGreaterThan(viewport.clientHeight);
|
||||
await expect(viewport.scrollHeight).toBeGreaterThan(viewport.clientHeight);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ export const Collapsed: Story = {
|
|||
const toggle = canvas.getByRole("button", {
|
||||
name: "Expand structured output",
|
||||
});
|
||||
expect(toggle).toHaveAttribute("aria-expanded", "false");
|
||||
await expect(toggle).toHaveAttribute("aria-expanded", "false");
|
||||
await userEvent.click(toggle);
|
||||
await waitFor(() =>
|
||||
expect(
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ export const Default: Story = {
|
|||
// Mantine renders the modal in a portal at document.body.
|
||||
const body = within(canvasElement.ownerDocument.body);
|
||||
await body.findByText("URL elicitation required");
|
||||
expect(body.getByText(/trigger-url-elicitation/)).toBeInTheDocument();
|
||||
await expect(body.getByText(/trigger-url-elicitation/)).toBeInTheDocument();
|
||||
const details = body.getByLabelText("Error details") as HTMLTextAreaElement;
|
||||
expect(details.value).toContain("-32042");
|
||||
expect(details.readOnly).toBe(true);
|
||||
await expect(details.value).toContain("-32042");
|
||||
await expect(details.readOnly).toBe(true);
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue