feat: use decline instead of reject
This commit is contained in:
parent
f2166c985f
commit
e6c8b946aa
4 changed files with 8 additions and 8 deletions
|
|
@ -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);
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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}>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export interface ElicitationRequestData {
|
|||
}
|
||||
|
||||
export interface ElicitationResponse {
|
||||
action: "accept" | "reject" | "cancel";
|
||||
action: "accept" | "decline" | "cancel";
|
||||
content?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue