feat: use decline instead of reject

This commit is contained in:
Alex Andru 2025-07-04 12:09:51 +02:00
commit e6c8b946aa
4 changed files with 8 additions and 8 deletions

View file

@ -132,7 +132,7 @@ const App = () => {
Array<
PendingElicitationRequest & {
resolve: (response: ElicitationResponse) => void;
reject: (error: Error) => void;
decline: (error: Error) => void;
}
>
>([]);
@ -223,7 +223,7 @@ const App = () => {
requestedSchema: request.params.requestedSchema,
},
resolve,
reject: (error: Error) => {
decline: (error: Error) => {
console.error("Elicitation request rejected:", error);
},
},

View file

@ -100,8 +100,8 @@ const ElicitationRequest = ({
}
};
const handleReject = () => {
onResolve(request.id, { action: "reject" });
const handleDecline = () => {
onResolve(request.id, { action: "decline" });
};
const handleCancel = () => {
@ -158,7 +158,7 @@ const ElicitationRequest = ({
<Button type="button" onClick={handleAccept}>
Submit
</Button>
<Button type="button" variant="outline" onClick={handleReject}>
<Button type="button" variant="outline" onClick={handleDecline}>
Decline
</Button>
<Button type="button" variant="outline" onClick={handleCancel}>

View file

@ -10,7 +10,7 @@ export interface ElicitationRequestData {
}
export interface ElicitationResponse {
action: "accept" | "reject" | "cancel";
action: "accept" | "decline" | "cancel";
content?: Record<string, unknown>;
}

View file

@ -138,14 +138,14 @@ describe("ElicitationRequest", () => {
});
});
it("should call onResolve with reject action when Decline button is clicked", async () => {
it("should call onResolve with decline action when Decline button is clicked", async () => {
renderElicitationRequest();
await act(async () => {
fireEvent.click(screen.getByRole("button", { name: /decline/i }));
});
expect(mockOnResolve).toHaveBeenCalledWith(1, { action: "reject" });
expect(mockOnResolve).toHaveBeenCalledWith(1, { action: "decline" });
});
it("should call onResolve with cancel action when Cancel button is clicked", async () => {